Upstrea/ Keepalive strange behaviour

David DONCHEZ david.donchez at
Mon Dec 9 16:52:11 UTC 2013

Hello all,

I have a strange behavior when using upstream/keepalive and it could be
fine if someone can give me some feedback regarding this setup.

I have multiple locations with proxy_pass directive, i use
proxy_http_version 1.1 and "Connection" header is cleared. 
In the upstream block, i have 2 or more upstream IP and i have add the
directive keepalive.

Now, sometimes i see this error log : "upstream prematurely closed
connection while reading response header from upstream".

A tcpdump show that nginx send a GET to his upstream but the TCP
connection is closed and nginx don't  receive the response from
upstream. Most of the time, nginx uses another upstream server and the
transaction is successfully completed.
This behavior appears with different upstream server.

If someone has experiencing this kind of issue, feedback are welcome !


David Donchez - Lead Engineer, Research & Engineering
SmartJog | T: +33 1 5868 6190
27 Blvd Hippolyte Marquès, 94200 Ivry-sur-Seine, France | a TDF Group company

More information about the nginx mailing list