<p>will nginx cache partial response when upstream prematutely close connection?</p>
<p>In our production environment, we found the following scenario requires one to manually clear proxy cache:</p>
<p>1. nginx asks upstrean for some large file, e.g., 5000KB</p>
<p>2. upstream send response, it flushes response header which (at least) contains content-length</p>
<p>3. Network is completely broken when 200KB was received by nginx. In about the same time, upstream closed connection by sending a FIN</p>
<p>4. nginx cache the partial response and use it to serve subsequent requests until expiration.</p>
<p>5. Browser request this large file then indefinitely hangs because content-length indicates there were more to come but actually nginx has nothing to send.</p>
<p>lei yang</p>