<div dir="auto"><div>Thanks.<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 30, 2023, 9:44 PM Maxim Dounin <<a href="mailto:mdounin@mdounin.ru">mdounin@mdounin.ru</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<br>
On Fri, Jun 30, 2023 at 01:24:18PM -0300, Fabiano Furtado Pessoa Coelho wrote:<br>
<br>
> Hello Maxim...<br>
> <br>
> On Thu, Jun 29, 2023 at 7:00 PM Maxim Dounin <<a href="mailto:mdounin@mdounin.ru" target="_blank" rel="noreferrer">mdounin@mdounin.ru</a>> wrote:<br>
> ><br>
> > Hello!<br>
> ><br>
> > On Thu, Jun 29, 2023 at 04:29:39PM -0300, Fabiano Furtado Pessoa Coelho wrote:<br>
> ><br>
> > > Hi...<br>
> ...<br>
> > > "proxy_intercept_errors on;"?<br>
> ><br>
> > The "proxy_intercept_errors" handling does not copy any response<br>
> > headers from the original response (the only exception is<br>
> > WWW-Authenticate for 403 responses).<br>
> ><br>
> > If you want nginx to copy some headers, consider doing it yourself<br>
> > with the $upstream_http_* variables and the add_header directive.<br>
> > Something like this should work:<br>
> ><br>
> > location /30x.html {<br>
> > add_header Location $upstream_http_location;<br>
> > ...<br>
> > }<br>
> ><br>
> > Note though that you'll have to manually rewrite location if<br>
> > needed (as proxy_redirect handling won't be used).<br>
> <br>
> Your approach worked fine for me! Thanks for the help.<br>
> <br>
> Horever, without this "add_header" modification and with<br>
> "proxy_intercept_errors on;", I've two situations:<br>
> * without "error_page 301 302 /30x.html;" directive configured: I<br>
> receive the HTTP "location" header from my NGINX;<br>
> * with "error_page 301 302 /30x.html;" directive configured: I don't<br>
> receive the HTTP "location" header from my NGINX;<br>
> <br>
> If "proxy_intercept_errors" handling does not copy any response<br>
> headers from the original response, why is this HTTP "location" header<br>
> present with "error_page 301 302 /30x.html;" directive configured in<br>
> my system?<br>
> <br>
> I really don't understand why it happens.<br>
<br>
The "proxy_intercept_errors" directive only works for error <br>
responses for which you have an error_page explicitly configured. <br>
That is:<br>
<br>
- If you don't have an error_page configured for the particular <br>
response code, nginx returns the original response as obtained <br>
from the upstream server, with all the response headers, much like <br>
it does with "proxy_intercept_errors off;".<br>
<br>
- If you do have an error_page configured, nginx instead <br>
intercepts the error as per "proxy_intercept_errors on;", and <br>
returns the error page to the client. This response does not contain<br>
headers from the original response.<br>
<br>
This seems to be exactly what you are seeing (assuming "with" in <br>
your final question is a typo, and you mean "without" instead). <br>
Hope this helps.<br>
<br>
-- <br>
Maxim Dounin<br>
<a href="http://mdounin.ru/" rel="noreferrer noreferrer" target="_blank">http://mdounin.ru/</a><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank" rel="noreferrer">nginx@nginx.org</a><br>
<a href="https://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer noreferrer" target="_blank">https://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div></div></div>