nginx upstream prematurely closed connection while reading upstream
nginx报错:
2019/09/04 08:52:20 [error] 17537#0: *10 upstream prematurely closed connection while reading upstream, server: localhost, request: "GET /test/a.js HTTP/1.1", upstream: "http://127.0.0.1:8091/test/a.js",
问题描述:
a.js 比较大 4M左右。 通过 upstream 读取,在全部数据读取完成前,连接关闭,导至前端报错
net::ERR_INCOMPLETE_CHUNKED_ENCODING 200
解决办法:
配置代理服务器的 header Connection: keep-alive
nginx配置:
proxy_http_version 1.1;
proxy_set_header Connection "";