0
点赞
收藏
分享

微信扫一扫

nginx使用wss协议出现wss handshake: Unexpected response code: 400


在nginx中配置好https协议之后,我以为可以使用反向代理在tomcat容器中的页面js调用websocket用wss了,但是没想到居然报了个错:

handshake: Unexpected response code: 400

查了一下官网才发现原来在配置反向代理的时候,如果需要使用wss,还需要加上如下配置:

location /wsapp/ {
proxy_pass http://wsbackend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}

官网链接:​​https://www.nginx.com/blog/websocket-nginx/​​


举报

相关推荐

0 条评论