On my developing macchine I have nginx as proxy server for websocket with this configuration:
server {
listen 80;
location /socket.io {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:3001;
proxy_redirect off;
}
location / {
proxy_pass http://trunk.alban:81;
client_max_body_size 500M;
}
}
When I access from the same macchine via firefox the websockets connects correctly and start exchanging messages:
[root@localhost nodejs]# node websocket.js
2014-12-04 10:27:16 ==> Listening on port: 3001
2014-12-04 10:27:16 ==> Auth token: alyt4qxs9k9k95a7q1if6r3a8b7yzaor
2014-12-04 10:27:29 ==> Client authorized: alyt4qxs9k9k95a7q1if6r3a8b7yzaor == alyt4qxs9k9k95a7q1if6r3a8b7yzaor
2014-12-04 10:27:29 ==> IP: [127.0.0.1], URL:[http://trunk.alban], Agent: [Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0]
2014-12-04 10:27:35 ==> Broadcasting clients: amend-view-status_13 {}
But When I accesss from another macchine, it connects but it does not sending/receiving any message, just loops in switching protocols, connecting and disconneting:
2014-12-04 10:32:23 ==> Client authorized: alyt4qxs9k9k95a7q1if6r3a8b7yzaor == alyt4qxs9k9k95a7q1if6r3a8b7yzaor
2014-12-04 10:32:23 ==> IP: [127.0.0.1], URL:[http://192.168.57.130], Agent: [Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0]
2014-12-04 10:32:43 ==> Client Disconnected
2014-12-04 10:32:44 ==> Client authorized: alyt4qxs9k9k95a7q1if6r3a8b7yzaor == alyt4qxs9k9k95a7q1if6r3a8b7yzaor
2014-12-04 10:32:44 ==> IP: [127.0.0.1], URL:[http://192.168.57.130], Agent: [Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0]
2014-12-04 10:33:04 ==> Client Disconnected
2014-12-04 10:33:06 ==> Client authorized: alyt4qxs9k9k95a7q1if6r3a8b7yzaor == alyt4qxs9k9k95a7q1if6r3a8b7yzaor
2014-12-04 10:33:06 ==> IP: [127.0.0.1], URL:[http://192.168.57.130], Agent: [Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0]
I have nginx 1.6.2 installed and socket.io 1.2.1.
I have disable all possible firewalls.
NOTE: If I remove nginx as proxy server, just by poiting to the socket.io server directly it works all fine in any macchine.
NOTE2: forcing using polling it works with no problems. Seems to be a problem with nginx/ws protocol...
Any ideas?