博主呓语:

Error during WebSocket handshake: Unexpected response code: 400 解决办法

Posted by 破冰 on 2016-7-8 14:36 Friday

nginx做代理转发WebSocket的时候,应用报Error during WebSocket handshake: Unexpected response code: 400,需要设置下proxy版本为1.1,参考如下:

Had the same issue, my app is behind nginx. Making these changes to my Nginx config removed the error.

location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}

This is originally from https://chrislea.com/2013/02/23/proxying-websockets-with-nginx/

标签:

发表评论: