标签:prot 访问 localhost cti conf res host while 代理
缘由:A项目用
HttpURLConnection
代理(B项目)内部接口的时候,返回值正常;
由于要走负载,nginx代理了几个A项目,通过nginx访问的时候,页面显示ERR_EMPTY_RESPONSE
;
nginx报错upstream sent invalid chunked response while reading upstream.
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;
proxy_cookie_path / /redirect;
}
完毕!
nginx报错upstream sent invalid chunked response while reading upstream
标签:prot 访问 localhost cti conf res host while 代理
原文地址:https://www.cnblogs.com/jarjune/p/14052662.html