跳转至

常见问题及命令

用Nginx转发WebSocket出现错误WebSocket failed: Error during WebSocket handshake: Unexpected response code: 400

是由于Nginx协议没搞对,解决: 在Nginx配置对应的location里加上

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
因为WebSocket链接非要用Http 1.1,nginx非不给,所以给了就行了

评论