编写版本:v3.5.0
适用版本:所有版本
代理是不允许出现下划线,否则会报400
如:
location /iform/ {
proxy_pass http://iform_gateway:15100/iform/;
}
解决方式:将主机名或域名通过upstream包装一层
upstream gateway {
server iform_gateway:15100 weight=2;
}
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /iform/ {
proxy_pass http://gateway/iform/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
websoket代理,报400
报以下错误:
error during Hebsocket handshake:Unexpected response code:400
解决方法:
参考:https://github.com/socketio/socket.io/issues/1942 说的很具体。
基本确定原因出在nginx配置
#修改nginx.conf配置
server {
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
作者:hugh 创建时间:2024-01-03 10:16
最后编辑:hugh 更新时间:2024-11-15 11:25
最后编辑:hugh 更新时间:2024-11-15 11:25