WebSocket反向代理
location /这里填路径 {
proxy_redirect off;
proxy_pass http://127.0.0.1:需要转发到的端口;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
#显示真实IP在v2ray的access.log日志中
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#防止显示Bad Request
proxy_intercept_errors on;
}
例子:
WebSocket反向代理
location /path {
proxy_redirect off;
proxy_pass http://127.0.0.1:3333;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
#显示真实IP在v2ray的access.log日志中
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#防止显示Bad Request
proxy_intercept_errors on;
}
访问xxx.com/path,则会反代到3333端口的应用。/