Think before you speak, read before you think.

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


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *