---
title: "nginx   upstream prematurely closed connection while reading upstream "
author: "java12345678"
date: "2019-09-04T09:09:16Z"
tags: []
categories: ["开源软件"]
slug: "nginx-upstream-prematurely-closed-connection-while-reading-upstream"
draft: false
lastmod: "2019-09-04T09:09:16Z"
id: 2444077
url: "https://java12345678.iteye.com/blog/2444077"
---

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 "";