error_page redirect sends incomplete request to upstream

Manole, Sorin manole at
Sun Jul 10 07:50:36 UTC 2016


I opened for this.

The bug appears when request_body_buffering is off (but maybe not only), and error pages are set to be served from an upstream using an internal redirect.

If a problem happens while the request body is read/sent to the upstream in a non-buffered fashion, and nginx tries to serve an error page, it rewrites the HTTP method from POST to GET request, but keeps the old value of the Content-Length header when trying to serve the error page from the upstream.
This is done here:
No body data is sent in the error page upstream request, even though it is declared in the header, which can cause the upstream server to wait for it. This is seen by the client as the request hanging until the configured upstream timeout.

Can this be fixed by clearing any Content-Length or Transfer-Encoding headers when error pages are served?

Thank you.

More information about the nginx-devel mailing list