nginx代理websocket錯誤處理
阿新 • • 發佈:2018-03-26
nginx代理websocket錯誤處理錯誤貼圖
nginx日誌報400 bad request錯誤
修改nginx配置文件
添加一下三行
server {
listen 80;
server_name localhost;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
#proxy_set_header Host $host:$server_port;
#proxy_set_header X-Real-Ip $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1; #添加
proxy_set_header Upgrade $http_upgrade; #添加
proxy_set_header Connection "upgrade"; #添加
}
}
nginx代理websocket錯誤處理