mrjoes / sockjs-tornado

WebSocket emulation - Python server
MIT License
849 stars 162 forks source link

how to use nginx proxy sockjs-tornado #65

Open wushuyi opened 10 years ago

wushuyi commented 10 years ago

how to use nginx proxy sockjs-tornado WebSocket connection to 'ws://192.168.122.141/tornado/sockjs/215/dm1kkghf/websocket' failed: Error during WebSocket handshake: Unexpected response code: 502

flaviogrossi commented 10 years ago

hi, i wrote about the nginx configuration needed for sockjs here https://github.com/flaviogrossi/sockjs-cyclone#nginx there is also an example configuration file linked there

hope this helps

wushuyi commented 10 years ago

Think you, I use nginx.conf: upstream frontends{ server 127.0.0.1:8001; server 127.0.0.1:8002; server 127.0.0.1:8003; server 127.0.0.1:8004; } server{ location /tornado/ { proxy_pass http://frontends/; proxy_set_header X-Scheme $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_pass_header Server; } } It work!