您的位置:首页 > 运维架构 > Nginx

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

2017-02-27 17:14 701 查看
在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/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx websocket tomcat
相关文章推荐