No headers filter for a subrequest

Marat Dakota dakota at brokenpipe.ru
Mon Mar 16 12:27:44 UTC 2015


But if I have:

/location1 {
    ...
}

/location2 {
    add_header XXX-Some-Header Ololo;
    ...
}

And I do a subrequest from /location1 handler to /location2?

On Mon, Mar 16, 2015 at 3:23 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:

> Hello!
>
> On Mon, Mar 16, 2015 at 03:14:15PM +0300, Marat Dakota wrote:
>
> > Hi,
> >
> > I was digging the reason why add_header in nginx config doesn't work for
> a
> > subrequest and I've found this in ngx_http_headers_filter_module.c:
> >
> >     if ((conf->expires == NGX_HTTP_EXPIRES_OFF && conf->headers == NULL)
> >         || r != r->main)
> >     {
> >         return ngx_http_next_header_filter(r);
> >     }
> >
> > Is there a particular reason to skip the filter for everything that's
> not a
> > main request?
>
> The main reason is that there are no headers in subrequest
> responses.  Headers are returned by the main request only.
>
> --
> Maxim Dounin
> http://nginx.org/
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20150316/1e5b538e/attachment.html>


More information about the nginx-devel mailing list