当Nginx代理websockt,其中涉及到了一个Nginx的设计问题 End-to-end and Hop-by-hop Headers
需要添加map配置,map在Nginx中是为一个或多个变量设置映射表
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
location / {
…
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}
原文链接:https://www.f2er.com/note/411466.html