"error_page"& "return" bug?

Maxim Dounin mdounin at mdounin.ru
Sun Feb 19 12:55:54 UTC 2012


Hello!

On Sun, Feb 19, 2012 at 03:23:58PM +0300, Nginx User wrote:

> On 19 February 2012 15:03, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > Hello!
> > It's not ignored, but returning error unconditionally in the
> > server context also prevents error_page processing from
> > working, as the "return 503" is again executed after error_page
> > internal redirect.  That is, something like this happens:
> >
> > 1. Request comes for "/something".
> > 2. Server rewrites generate 503.
> > 3. Due to error_page set the request is internally redirected to
> >   /error_docs/custom503.html.
> > 4. Server rewrites again generate 503.
> > 5. As we've already did error_page redirection, nginx ignores
> >   error_page set and returns internal error page.
> 
> This then is the "bug".
> It SHOULD now return "/error_docs/custom503.html" with a 503 status code.
> I.E., work as it does when the error is issued within a location
> context since once a user has set error_page, they would most likely
> expect a matching status return to deliver what was set.

This is not a bug.  You instructed nginx to generate 503 on each 
request which hits server rewrite phase, and it does what you 
said.

Maxim Dounin



More information about the nginx mailing list