LearnBoost/socket.io — Issue #589: Problems with Squid 2.7 and Socket.IO - 502 Bad gateway.  No transports work.
Author: chrisdew
Created: 2011-10-21 07:44:00+00:00
State: open

FIrstly, I fully expect the WebsSocket trasport to fail, when used through Squid 2.7.

I did expect the XHR polling, or at least one of the others to work though. What I see is no working transport. I've tried the latest FF and Chrome.

I have recently wanted to move a NodeJS application which serves up a stream of live data over Socket.IO from a high port number to port 80. When using a high port number (or even port 81 in a test), everything works fine.

When I switch it to port 80 (it's on a different subdomain from the site whose pages make the connection) it fails to connect. (We want to use port 80 as some of our users are behind draconian firewalls which filter outgoing traffic.)

We use Squid as a transparent proxy within our offices, and this hijacks all port 80 traffic, including this Socket.IO traffic. The client first reports: 502 Bad gateway (for the attempted

WebSocket connection, then all subsequent requests yield '8::' or 'io.j[1]("8::");' depending in the transport.

I have attached a typical NodeJS processes log below, along with Squid's log for the same time period.

When I use iptables to avoid Squid by rewriting the destination as the backend server (i.e. not going over Squid/DMZ), it works fine - so it's not port-number-80 related - it's Squid.

Has anyone seen a similar problem?

Will this be a problem for all Squid users, or does our network just have a badly configured squid?

Thanks,

Chris.

debug - served static content /socket.io.js
debug - client authorized
info - handshake authorized 13343548761634704685
debug - setting request GET /socket.io/1/websocket/13343548761634704685
debug - set heartbeat interval for client 13343548761634704685
warn - websocket connection invalid
info - transport end
debug - set close timeout for client 13343548761634704685
debug - cleared close timeout for client 13343548761634704685
debug - cleared heartbeat interval for client 13343548761634704685
debug - client authorized for
debug - setting request GET /socket.io/1/websocket/13343548761634704685
debug - set heartbeat interval for client 13343548761634704685
warn - websocket connection invalid
info - transport end
debug - set close timeout for client 13343548761634704685
debug - cleared close timeout for client 13343548761634704685
debug - cleared heartbeat interval for client 13343548761634704685
debug - setting request GET /socket.io/1/websocket/13343548761634704685
debug - set heartbeat interval for client 13343548761634704685
warn - websocket connection invalid
info - transport end
debug - set close timeout for client 13343548761634704685
debug - cleared close timeout for client 13343548761634704685
debug - cleared heartbeat interval for client 13343548761634704685
debug - setting request GET /socket.io/1/xhr-polling/13343548761634704685?t=1319118370426
debug - setting poll timeout
debug - setting request GET /socket.io/1/jsonp-polling/13343548761634704685?t=1319118380435&i=1
debug - setting poll timeout
debug - discarding transport
debug - clearing poll timeout
debug - clearing poll timeout
debug - jsonppolling writing io.j[1]("8::");
debug - set close timeout for client 13343548761634704685
debug - jsonppolling closed due to exceeded duration
debug - setting request GET /socket.io/1/jsonp-polling/13343548761634704685?t=1319118400457&i=1
debug - setting poll timeout
debug - discarding transport
debug - cleared close timeout for client 13343548761634704685
debug - clearing poll timeout
debug - jsonppolling writing io.j[1]("8::");
debug - set close timeout for client 13343548761634704685
debug - jsonppolling closed due to exceeded duration
debug - setting request GET /socket.io/1/jsonp-polling/13343548761634704685?t=1319118420484&i=1
debug - setting poll timeout
debug - discarding transport
debug - cleared close timeout for client 13343548761634704685

1319118333.309 1053 192.168.1.128 TCP_MISS/200 69811 GET http://njs.example.com/socket.io/socket.io.js - DIRECT/111.111.111.111 application/javascript
1319118333.516 1 192.168.1.128 TCP_MISS/200 276 GET http://njs.example.com/socket.io/1/? - DIRECT/111.111.111.111 application/javascript
1319118333.658 108 192.168.1.128 TCP_MISS/502 1474 GET http://njs.example.com/socket.io/1/websocket/13343548761634704685 - DIRECT/111.111.111.111 text/html
1319118373.565 20010 192.168.1.128 TCP_MISS/200 262 GET http://njs.example.com/socket.io/1/jsonp-polling/13343548761634704685? - DIRECT/111.111.111.111 text/javascript
1319118393.589 20014 192.168.1.128 TCP_MISS/200 262 GET http://njs.example.com/socket.io/1/jsonp-polling/13343548761634704685? - DIRECT/111.111.111.111 text/javascript