WebSocket WebSocket双向通信nginx部署失败的原因
WebSocket WebSocket connection to 'ws://localhost/ws/jc9s0jyqa5s' failed
配置 nginx.conf 文件
http中配置
map $http_upgrade $connection_upgrade{
default upgrade;
'' close;
}
server 中配置 http://localhost:8080/ws/;为后端端口前缀
location /ws/ {
proxy_pass http://localhost:8080/ws/;
proxy_http_version 1.1;
proxy_read_timeout 3600s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "$connection_upgrade";
}