internal X-Accel-Redirect for PUT

Maxim Dounin mdounin at
Wed Jan 11 16:15:59 UTC 2017


On Wed, Jan 11, 2017 at 03:03:34PM +0000, Jakub Moscicki wrote:

> Was there a change of behaviour as per how PUT requests are 
> redirected via X-Accel-Redirect between 1.6.2 and 1.10.2 
> versions?
> In nginx 1.6.2 the PUT request from the client is internally 
> redirected as PUT via X-Accel-Redirect. In 1.10.2 it is 
> redirected as GET. So the method name is changes when the 
> redirect happens.
> The redirect is between two upstream servers (and not the 
> client) via an internal location.
> Is there a way to achieve 1.6.2 behaviour?

The previous behaviour was a bug, as nginx interpreted 
X-Accel-Redirect'ed requests as GET internally, but still used 
original request method in requests to upstream servers.  This was 
fixed in 1.9.10:

    *) Bugfix: proxying used the HTTP method of the original request after
       an "X-Accel-Redirect" redirection.

If you want to preserve original request method, use 
X-Accel-Redirect to a named location.  Much like in case of 
error_page (, this will preserve URI 
and request method during redirection.

Maxim Dounin

More information about the nginx-devel mailing list