遇到nginx报错:websocket wss failed: Error during WebSocket handshake: Unexpected response code: 403
server {
listen 6340;
location / {
proxy_pass http://web;
proxy_http_version 1.1; #Nginx在与Node后端通信时使用HTTP/1.1,是WebSockets所必需的
proxy_set_header Origin '';
proxy_set_header Upgrade $http_upgrade; #Nginx响应升级请求,当浏览器想要使用WebSocket时,该请求由HTTP启动
proxy_set_header Connection "Upgrade";
}
}
代理 TCP和UDP
stream {
upstream pptcp {
server 10.10.10.10:9994;
server 10.10.10.11:9994;
}
server {
listen 9994;
proxy_pass pptcp;
proxy_connect_timeout 10s;
proxy_timeout 3h;
}
upstream ppudp {
server 10.10.10.10:9995;
server 10.10.10.11:9995;
}
server {
listen 9995 udp;
proxy_pass ppudp;
proxy_connect_timeout 10s;
proxy_timeout 3h;
}
}
原文地址:https://www.cnblogs.com/fan-gx/p/nginx.html
时间: 2024-10-04 09:49:15