本地直连服务器后端 ws请求正常,走nginx 时 ws 请求报 websocket is closed before the connection is established ,
nginx 1.18.0
nginx 配置
```xml
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
```xml
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme; # 真实用户访问协议
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";