nodejitsu/node-http-proxy — Issue #144: socket.io with node-http-proxy websockets "websocket connection invalid" 
Author: coolbloke1324
Created: 2011-11-03 20:12:22+00:00
State: open

Hey folks,

Seeing an issue with socket.io 0.8.6 and http-node-proxy 0.7.3. When I run the socket.io server without proxying connections there is no issue.

I have a socket.io server listening on port 9001 and a node-http-proxy server running on port 80. When requests come in for "ic.isogenicengine.com" they are proxied to port 9001.

I can establish websocket connections and send some data but once the connection has been up for about 10 - 30 seconds and has done a heartbeat signal, the server states "warn - websocket connection invalid"

The socket.io output is here:

debug - emitting heartbeat for client 758674003956265495
debug - websocket writing 2::
debug - set heartbeat timeout for client 758674003956265495
debug - got heartbeat packet
debug - cleared heartbeat timeout for client 758674003956265495
debug - set heartbeat interval for client 758674003956265495
debug - setting request GET /socket.io/1/websocket/758674003956265495
debug - set heartbeat interval for client 758674003956265495
warn - websocket connection invalid
info - transport end
debug - set close timeout for client 758674003956265495
debug - cleared close timeout for client 758674003956265495
debug - cleared heartbeat interval for client 758674003956265495

I am using Chrome 15.0.874.106

As I say, if I remove the proxy and connect directly to socket.io there is no issue. I am proxying connections via my proxy project https://github.com/coolbloke1324/node-irrelon-router (which uses node-http-proxy extensively).