websocket - Nginx 1.4.1 + Socket.io couldn't work. Handshake authorized but not working -
i using nginx 1.4.1 , trying configure work socket.io websockets. think have done correctly since see 'handshake authorized', after few seconds socket.io starts using xhr-polling, jsonp-polling , couldn't work.
my node.js express app runs on localhost:3002. , use nginx reverse proxy app. socket.io listening on same port.
i tried follow many guides in , elsewhere couldn't work. need experts. i've placed error log in here, not sure if help.
nginx.conf:
upstream instaneous { server 127.0.0.1:3002; } server { listen 80; server_name instaneous.pin.gs; access_log logs/instaneous.access.log; error_log logs/instaneous.error.log; location / { proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $http_host; proxy_set_header x-nginx-proxy true; proxy_pass http://instaneous; proxy_redirect off; # enables ws support proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; } }
node.js socket.io log
debug - client authorized info - handshake authorized z7cx6-3piustxileitk3 debug - setting request /socket.io/1/websocket/z7cx6-3piustxileitk3 debug - set heartbeat interval client z7cx6-3piustxileitk3 debug - client authorized debug - websocket writing 1:: debug - setting request /socket.io/1/xhr-polling/z7cx6-3piustxileitk3?t=1373509382625 debug - setting poll timeout debug - discarding transport debug - cleared heartbeat interval client z7cx6-3piustxileitk3 debug - setting request /socket.io/1/jsonp-polling/z7cx6-3piustxileitk3?t=1373509392627&i=0 debug - setting poll timeout debug - discarding transport debug - clearing poll timeout debug - clearing poll timeout debug - jsonppolling writing io.j[0]("8::"); debug - set close timeout client z7cx6-3piustxileitk3 debug - jsonppolling closed due exceeded duration debug - setting request /socket.io/1/jsonp-polling/z7cx6-3piustxileitk3?t=1373509412768&i=0 debug - setting poll timeout debug - discarding transport debug - cleared close timeout client z7cx6-3piustxileitk3 debug - jsonppolling received data packet 5:::{"name":"join","args":["abcdef"]} { '': [ 'z7cx6-3piustxileitk3' ], '/abcdef': [ 'z7cx6-3piustxileitk3' ] } debug - clearing poll timeout debug - jsonppolling writing io.j[0]("8::"); debug - set close timeout client z7cx6-3piustxileitk3 debug - jsonppolling closed due exceeded duration debug - client authorized info - handshake authorized blbss3qlgn54bthtitk4 debug - client authorized info - handshake authorized 6todyiysxiz_b19gitk5
instaneous.error.log
2013/07/11 04:01:49 [error] 406#0: *1 upstream prematurely closed connection while reading response header upstream, client: 220.255.2.143, server: instaneous.pin.gs, request: "get /socket.io/1/xhr-polling/afh6as6ku3hm36qh49di?t=1373515290708 http/1.1", upstream: "http://127.0.0.1:3002/socket.io/1/xhr-polling/afh6as6ku3hm36qh49di?t=1373515290708", host: "instaneous.pin.gs", referrer: "http://instaneous.pin.gs/" 2013/07/11 04:01:49 [error] 406#0: *4 upstream prematurely closed connection while reading response header upstream, client: 220.255.2.163, server: instaneous.pin.gs, request: "get /socket.io/1/jsonp-polling/afh6as6ku3hm36qh49di?t=1373515300709&i=0 http/1.1", upstream: "http://127.0.0.1:3002/socket.io/1/jsonp-polling/afh6as6ku3hm36qh49di?t=1373515300709&i=0", host: "instaneous.pin.gs", referrer: "http://instaneous.pin.gs/" 2013/07/11 04:01:49 [error] 406#0: *1 connect() failed (111: connection refused) while connecting upstream, client: 220.255.2.143, server: instaneous.pin.gs, request: "post /socket.io/1/jsonp-polling/afh6as6ku3hm36qh49di?t=1373515309646&i=0 http/1.1", upstream: "http://127.0.0.1:3002/socket.io/1/jsonp-polling/afh6as6ku3hm36qh49di?t=1373515309646&i=0", host: "instaneous.pin.gs", referrer: "http://instaneous.pin.gs/" 2013/07/11 04:01:49 [error] 406#0: *1 connect() failed (111: connection refused) while connecting upstream, client: 220.255.2.143, server: instaneous.pin.gs, request: "get /socket.io/1/?t=1373515310157 http/1.1", upstream: "http://127.0.0.1:3002/socket.io/1/?t=1373515310157", host: "instaneous.pin.gs", referrer: "http://instaneous.pin.gs/" 2013/07/11 04:01:50 [error] 406#0: *1 connect() failed (111: connection refused) while connecting upstream, client: 220.255.2.143, server: instaneous.pin.gs, request: "get /socket.io/1/?t=1373515311158 http/1.1", upstream: "http://127.0.0.1:3002/socket.io/1/?t=1373515311158", host: "instaneous.pin.gs", referrer: "http://instaneous.pin.gs/"
Comments
Post a Comment