chrome错误代码为
Error during WebSocket handshake: Unexpected response code: 400
观察会发现chrome使用ws连接时出现上面的错误,然后开始使用http方式进行轮询。原因就是http协议无法升级为ws协议。修改nginx配置方式可解。
location / {
proxy_pass http://node:8018;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header Host $host;
}
注释掉最后一行是因为会产生循环代理问题
网友评论