Possible bug with "proxy_intercept_errors on; " + "error_page 301 302"?

Fabiano Furtado Pessoa Coelho fusca14 at gmail.com
Fri Jun 30 16:24:18 UTC 2023


Hello Maxim...

On Thu, Jun 29, 2023 at 7:00 PM Maxim Dounin <mdounin at mdounin.ru> wrote:
>
> Hello!
>
> On Thu, Jun 29, 2023 at 04:29:39PM -0300, Fabiano Furtado Pessoa Coelho wrote:
>
> > Hi...
...
> > "proxy_intercept_errors on;"?
>
> The "proxy_intercept_errors" handling does not copy any response
> headers from the original response (the only exception is
> WWW-Authenticate for 403 responses).
>
> If you want nginx to copy some headers, consider doing it yourself
> with the $upstream_http_* variables and the add_header directive.
> Something like this should work:
>
>     location /30x.html {
>         add_header Location $upstream_http_location;
>         ...
>     }
>
> Note though that you'll have to manually rewrite location if
> needed (as proxy_redirect handling won't be used).

Your approach worked fine for me! Thanks for the help.

Horever, without this "add_header" modification and with
"proxy_intercept_errors on;", I've two situations:
* without "error_page 301 302 /30x.html;" directive configured: I
receive the HTTP "location" header from my NGINX;
* with "error_page 301 302 /30x.html;" directive configured: I don't
receive the HTTP "location" header from my NGINX;

If "proxy_intercept_errors" handling does not copy any response
headers from the original response, why is this HTTP "location" header
present with "error_page 301 302 /30x.html;" directive configured in
my system?

I really don't understand why it happens.

Well, thanks again.
Fabiano


More information about the nginx mailing list