原因

http协议版本不一致导致

解决方案

在nginx.conf的location里加上

proxy_http_version 1.1;
proxy_set_header   Connection       "";

示例

location /redirect/ {
    proxy_pass http://localhost:8080/;
    proxy_http_version 1.1;
    proxy_set_header   Connection       "";
    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   X-Forwarded-Proto $scheme;
}

感谢大家的阅读, 如有疑问可以加我微信