nginx反向代理webman出现502错误 upstream prematurely closed

supereric

nginx反向代理webman出现502错误

nginx 错误

2021/05/21 23:21:46 [error] 75037#0: *234 upstream prematurely closed connection while reading response header from upstream, client: 172.16.253.1, server: webman.cc, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "webman.cc"

nginx location配置为

location /
{
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    add_header X-Cache $upstream_cache_status;
    #Set Nginx Cache
    add_header Cache-Control no-cache;
    expires 12h;
}

将配置项

proxy_set_header Connection "Upgrade";

修改为

proxy_set_header Connection "Keep-Alive";

后问题解决。ws连接正常
和文档中不太一样有人可以解释一下问题吗

阅读 1392
2个评论

walkor

webman文档没有让使用proxy_set_header Connection "Upgrade";吧,这个配置是配置websocket代理的方法。

  • 暂无评论
supereric

嘿嘿。明白了

  • 暂无评论

supereric

-12
积分
0
获赞数
0
粉丝数
2019-03-11 加入