Strange error_page behavior

Fabiano Furtado Pessoa Coelho fusca14 at gmail.com
Fri Aug 7 13:29:45 UTC 2020


Thanks for the reply and I'm sorry! It was my fault that I didn't see
that text in the documentation.

"These directives are inherited from the previous level if and only if
there are no error_page directives defined on the current level."

On Fri, Aug 7, 2020 at 4:05 AM Francis Daly <francis at daoine.org> wrote:
>
> On Thu, Aug 06, 2020 at 09:43:46PM -0300, Fabiano Furtado Pessoa Coelho wrote:
>
> Hi there,
>
> > http {
> >   error_page 502 503 /my503.html;
> >   ...
> >   server {
> >     ...
> >     error_page 403 =503 /my503.html;
> >     #error_page 502 503  /my503.html;
>
> > I can solve this issue uncommenting the "#error_page 502 503
> > /my503.html;" line in server block, but this configuration is already
> > defined in http block, which is hierarchically superior in comparison
> > with server block. Why NGINX isn't regarging the error_page in http
> > block?
>
> Nginx directive inheritance is (in general) "by replacement" or "not
> at all".
>
> If you have a directive in a location, that is the full set of
> that-directives that applies to the matching request.
>
> Since you have an error_page at server{} level, any error_page defined
> at http level is irrelevant for any request handled in this server{}.
>
> http://nginx.org/r/error_page
>
> If you want a distinct set of error_page directives to apply at
> server{}-level, you must write them all there (perhaps by "include"ing
> a file).
>
>         f
> --
> Francis Daly        francis at daoine.org
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx


More information about the nginx mailing list