I deploy a Meteor app, and proxy it with nginx. When connect to the app server, there's a websocket error:
WebSocket connection to 'ws://prod-app-192-168-100-21.newfairs-inc.com/sockjs/311/ud_4e5xf/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
Solution:
cat /etc/nginx/sites-enabled/newfairs
server {
server_name prod-app-192-168-100-21.newfairs-inc.com;
location / {
proxy_pass http://localhost:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Ref:
Meteor WebSocket handshake error 400 with nginx
http://stackoverflow.com/questions/30171179/meteor-websocket-connection-to-ws-websocket-failed-error-during-websock