conditionally disable keepalives

Ryan Malayter malayter at
Fri Sep 17 20:27:14 MSD 2010

Is it possible to conditionally disable keep-alives via some sort of
configuration? I have a customer with a buggy proxy that they cannot
fix short-term, but I do not want to disable keepalives entirely for
every user. With keepalives enabled, they intermittently see "raw"
HTTP streams in the browser, headers and all. Thousands of other
customers have no issues, of course, as they aren't using this
particular proxy (Trend Micro Viruswall 6).

The "keepalive_timeout" directive will not accept a variable value.

Right now I have a configuration that conditionally adds a
"Connection: close" header based on $remote_addr, but that gets sent
in addition to the "Connection: keepalive" header set by nginx. While
it seems to work for this particular buggy proxy, sending multiple
"Connection" headers is also an HTTP specification violation, I think.

The only other thing I can think of to do is a rewrite to a different
server or location with "keepalive_timeout 0" specified, but will that
even work, or are keepalives handled at the connection layer?

nginx 0.7.65 on Ubuntu 10.04

More information about the nginx mailing list