keepalive and 5xx

Maxim Dounin mdounin at
Wed Jul 11 03:36:11 UTC 2018


On Tue, Jul 10, 2018 at 04:59:43PM -0700, Frank Liu wrote:

> When you say "Keepalive is automatically switched off...", do you mean
> nginx will send "Connection: close" as part of the response? What happens
> if client doesn't honor that, and keeps sending another request to the
> existing connection?

This means that nginx will not use keepalive for a particular 
connection.  That is, it will send "Connection: close" and will 
close the connection.  If there are any additional requests in the 
connection (either pipelined, or due client ignoring "Connection: 
close" signal), the client will have to retransmit them.  Much 
like in any other case when keepalive is switched off.

> You also mentioned "error codes is generated by nginx itself", so what
> happens if nginx is used as reverse proxy, and the error code is coming
> from upstream? Will nginx switch off keepalive with client too?

No (and that's why I wrote "generated by nginx itself").  As long 
as the code is in an upstream response, it is simply passed to the 

Maxim Dounin

More information about the nginx mailing list