"error_page"& "return" bug?

Maxim Dounin mdounin at mdounin.ru
Sun Feb 19 13:04:13 UTC 2012


Hello!

On Sun, Feb 19, 2012 at 03:45:15PM +0300, Nginx User wrote:

> On 19 February 2012 15:03, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > Another possible aproach is to use named location in error_page.
> > It won't re-execute server rewrites (that is, rewrite module
> > directives, including the "return" directive, specified at server
> > level) and will work as well.
> 
> Unfortunately, this doesn't appear to work as expected either
> 
> Server {
>        # listen etc
>        ...
> 
>        error_page 503 = @sitedown;
>        return 503
>        location @sitedown {
>                root /server/path/to/folder;
>                # Don't you wish try_files could accept a single parameter?
>                try_files $uri /custom503.html;

Unless you have $uri file, this will do an internal redirect to 
/custom503.html, triggering the same 503 again.  You have to 
process request in the location in question to make things work.

Maxim Dounin



More information about the nginx mailing list