皮卡丘爱唱歌 (@pikapika) 在 nginx配置 websocket相关 求助 中发帖
目前系统加入了websocket的请求,本地部署使用nginx转发请求
现在有一个服务service:
nginx的location块配的
location ^~/service/ {
#rewrite ^/apiservice/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:5010;
}
这个服务现在要同时支持http1.1和websocket
根据AI和网页搜索给出的解决方案是
map $http_upgrade $connection_upgrade {
default upgrade;
‘’ close;
}
location ^~/service/ {
proxy_pass http://127.0.0.1:5010;
proxy_set_header Upgrade...