x-accel-redirect enables caching for POST requests
Руслан Закиров
ruz at sports.ru
Wed Dec 23 21:16:43 UTC 2015
On Wed, Dec 23, 2015 at 7:19 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> On Wed, Dec 23, 2015 at 07:10:43PM +0300, Руслан Закиров wrote:
>
> > On Wed, Dec 23, 2015 at 6:49 PM, Maxim Dounin <mdounin at mdounin.ru>
> wrote:
> >
> > > X-Accel-Redirect changes a request from POST to GET.
> > >
> >
> > No, it doesn't. Getting request method POST on the backend and even form
> > data is intact.
>
> It does,
> http://hg.nginx.org/nginx/file/tip/src/http/ngx_http_upstream.c#l2501:
>
> if (r->method != NGX_HTTP_HEAD) {
> r->method = NGX_HTTP_GET;
> }
>
> Though it looks like it only does so for nginx itself, and this
> indeed looks like a bug. The code should be similar to one in
>
Would you create an issue for this in tracker or do I need to so it doesn't
disappear in archives?
> error_page handling:
>
> if (r->method != NGX_HTTP_HEAD) {
> r->method = NGX_HTTP_GET;
> r->method_name = ngx_http_core_get_method;
> }
>
> If you want to get request and request method intact, use
> X-Accel-Redirect to a named location instead.
Understood and it works for our case. We actually don't want to send POST
requests to location that issues internal redirects (our HRU service), but
we haven't found good way to avoid it.
--
Руслан Закиров
Руководитель отдела разработки веб-сервисов
+7(916) 597-92-69, ruz @ <http://www.sports.ru/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20151224/02dbcf76/attachment.html>
More information about the nginx
mailing list