websocket 请求经过 nginx 后,可能会不正常,需要如下配置,相关的头才可以
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name 192.168.1.1;
charset utf-8;
location /stomp/ {
proxy_pass http://192.168.7.2:9541;
# client_max_body_size 500M;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}