<div dir="ltr">But if I have:<div><br></div><div>/location1 {</div><div> ...</div><div>}</div><div><br></div><div>/location2 {</div><div> add_header XXX-Some-Header Ololo;</div><div> ...</div><div>}</div><div><br></div><div>And I do a subrequest from /location1 handler to /location2?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 16, 2015 at 3:23 PM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<div><div class="h5"><br>
On Mon, Mar 16, 2015 at 03:14:15PM +0300, Marat Dakota wrote:<br>
<br>
> Hi,<br>
><br>
> I was digging the reason why add_header in nginx config doesn't work for a<br>
> subrequest and I've found this in ngx_http_headers_filter_module.c:<br>
><br>
> if ((conf->expires == NGX_HTTP_EXPIRES_OFF && conf->headers == NULL)<br>
> || r != r->main)<br>
> {<br>
> return ngx_http_next_header_filter(r);<br>
> }<br>
><br>
> Is there a particular reason to skip the filter for everything that's not a<br>
> main request?<br>
<br>
</div></div>The main reason is that there are no headers in subrequest<br>
responses. Headers are returned by the main request only.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Maxim Dounin<br>
<a href="http://nginx.org/" target="_blank">http://nginx.org/</a><br>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</font></span></blockquote></div><br></div>