nginx代理websocket

map $http_upgrade $connection_upgrade {
 default upgrade;
 '' close;
}

upstream proxy_stomp {
 server 192.168.1.1:3000;
}

server {
 listen 3001;
 server_name proxy.abc.com;
 location / {
 proxy_pass http://proxy_stomp;
 proxy_http_version 1.1;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection "upgrade";
 }
}

upgrade 意思为升级为其他协议

http://nginx.org/en/docs/http/websocket.html

发表评论

电子邮件地址不会被公开。 必填项已用*标注