nginx转发不支持 websocket原因
Upgrade: websocket
Upgrade: websocket
关键参数:Upgrade
nginx在反向代理的时候 少转发了头,添加上就可以了。
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
完整配置:
location / {
proxy_pass http://cluster;
client_max_body_size 500M;
client_body_buffer_size 10M;
fastcgi_intercept_errors on;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass http://cluster;
client_max_body_size 500M;
client_body_buffer_size 10M;
fastcgi_intercept_errors on;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}