I'm trying to get websockets to also work with node-http-proxy
. The difference is i'm using a proxytable:
var options = {
router: {
'a.websterten.com': '127.0.0.1:150',
'b.websterten.com' : '127.0.0.1:151',
}
};
var server = httpProxy.createServer(options);
I tried:
server.on('upgrade', function (req, socket, head) {
server.proxy.proxyWebSocketRequest(req, socket, head);
});
But it doesn't seem to work. A quick check to see whether websockets work shows I get Unexpected response code: 400
from Chrome (works fine if I go directly)
Also doing a couple of checks server.on('upgrade',..
doesn't fire on a websocket request
How can I get my proxy server to route websockets correctly?
I've also tried this on node 0.8.23 as well as node 0.10.x (the later versions of node have a memory leak issue, but it wont work on 0.8.23 either)