POST method with x-accel-redirect

Francis Daly francis at
Tue Dec 6 20:46:03 UTC 2016

On Mon, Dec 05, 2016 at 09:01:09PM -0800, Yong Li wrote:

Hi there,

> But since we upgraded it to 1.10.1 it seems the POST method
> is changed to GET during the redirect.  I saw Maxim had a post (
>,263661,264440#msg-264440) describing
> this issue.  But I am still not sure what does it mean by "x-accel-redirect
> to a named location".

<snip bits>
>    location /api/v1/files {
>         proxy_pass http://tomcat;
>     }
>     location ~ ^/(all|groups|channels|users) {
>         internal;
>         proxy_pass http://file_server;
>     }

If I POST to /api/v1/files/two, nginx will proxy_pass a POST to

Tomcat will return HTTP 200 with a header X-Accel-Redirect with
something like /all/two. Then your nginx will proxy_pass a GET to

I think that the suggestion is that if your tomcat instead returns
HTTP 200 with a header X-Accel-Redirect of @fileserver, then in
your (new) "location @fileserver", a proxy_pass would be a POST to

Does that help in the design of your solution?

Francis Daly        francis at

More information about the nginx mailing list