POST method with x-accel-redirect

Yong Li yrcompute at gmail.com
Tue Dec 6 21:12:36 UTC 2016


Hi Francis,

Yeah, I think this is what I need! Thanks a lot for your explanation, which
definitely helps my design.

Best,

- Yong

- Yong
Y&R Computing

On Tue, Dec 6, 2016 at 12:46 PM, Francis Daly <francis at daoine.org> wrote:

> 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 (
> > https://forum.nginx.org/read.php?2,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
> http://tomcat/api/v1/files/two
>
> 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
> http://file_server/all/two.
>
>
> 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
> http://file_server/api/v1/files/two.
>
>
> Does that help in the design of your solution?
>
>         f
> --
> Francis Daly        francis at daoine.org
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20161206/f57d7fa1/attachment.html>


More information about the nginx mailing list