Skip to content

Instantly share code, notes, and snippets.

@xx7y7xx
Last active Aug 10, 2017
Embed
What would you like to do?
nginx socket.io proxy
# MFC project START
# web page and static files
location ^~ /m/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://10.3.14.1:3000/m/;
proxy_redirect http:// https://;
}
# socket.io(websocket)
# http://nginx.org/en/docs/http/websocket.html
# need nginx@1.3.13 to support Upgrade header
location ^~ /socket.io/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://10.3.14.1:3000/socket.io/;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# MFC project END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment