Nginx behind a reverse proxy sending 499

ppwm nginx-forum at
Sun Jan 11 06:37:31 UTC 2015

To debug the issue further, I wrote a simple Java based HTTP client. This
client would open a socket to the nginx server, write the request line (GET
/ HTTP/1.1), write the host header, write the Connection:close header and
commit the request. While committing the write the CRLF character twice.

In this setup, I tested by having a proxy pass to and not
having a proxy pass (nginx servers the default index.html.

If there is no proxy pass, nginx never gives a 499 status code. Even if I do
Socket.shutdownOutput(), nginx give a valid 200 response. This is
irrespective of the Connection header (keepalive/close).

If there is proxy pass,  I get a valid response if I don't do
Socket.shutdownOutput(). But if I do Socket.shutdownOutput(), I get 499
irrespective of Connection header (keepalive/close). This implies that nginx
is treating client's Socket.shutdownOutput() as client closing the
connection despite all data being written to the socket.

Posted at Nginx Forum:,256028,256035#msg-256035

More information about the nginx mailing list