title: NodeJS, http-proxy, socket.io
body: <p>I am running a express web application on port 3030, but it is proxied through <a href="https://github.com/nodejitsu/node-http-proxy" rel="nofollow">http-proxy</a>. The site works fine this way, but socket.io will not connect. It does recieve something as my console displays:</p>
  
  <pre><code>debug - served static content /socket.io.js
  debug - client authorized
  info  - handshake authorized 11319742841450363586
  debug - setting request GET /socket.io/1/websocket/11319742841450363586
  debug - set heartbeat interval for client 11319742841450363586
  debug - client authorized for 
  debug - websocket writing 1::
  </code></pre>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>app.listen(3030)
  
  io = require('socket.io')
  socket = io.listen(app)
  
  socket.on('connection', function(client) {
    console.log('new connection')
  })
  </code></pre>
  
  <p><strong>chat.js</strong></p>
  
  <pre><code>$(function() {
    console.log('connecting to chat...')
    var socket = io.connect('http://mydomain.com:80')
  
    socket.on('connected',function(){
      console.log('connected')
    })
  })
  </code></pre>
  
  <p>However, neither of the console.log statements ever display on the client or server side. What am I doing wrong?</p>
  
  <p><strong>EDIT - Added http-proxy code</strong></p>
  
  <pre><code>var httpProxy = require('http-proxy')
    , proxyTable = {
        router: {
          'lou.mydomain.com': '127.0.0.1:3030'
        , 'foe.mydomain.com': '127.0.0.1:3000'
        // and some others
        }
      }
    , proxyServer = httpProxy.createServer(proxyTable);
  
  proxyServer.listen(80);
  </code></pre>