"error_page"& "return" bug?

Edho Arief edho at myconan.net
Sun Feb 19 16:44:15 UTC 2012


On Sun, Feb 19, 2012 at 11:37 PM, Nginx User <nginx at nginxuser.net> wrote:
>>>
>>> #############
>>> server {
>>>   error_page 503 /error_docs/custom503.html;
>>>  location / {
>>>    return 503;
>>>    ...normal configs...
>>>  }
>>>  location /error_docs/ {
>>>    internal;
>>>    alias /server/path/to/error_docs/folder;
>>>  }
>>> }
>>> #############
>
> Your method will work if you only a few location blocks active to
> which you can easily add the return directive.
>

You can nest all your location blocks in single location / { } block
(and you can put location / { } in location / { }). Just add "location
/ {" before start of other locations (except error page) and "}" after
them.

Also have you tried this one? Instead of plain "return 503;" in server block:

server {
if ($uri !~ ^/error_page/) {
  return 503;
}
...
}

Because even if "return 503" is capable of returning the page you
want, the css/js/image still won't work.

-- 
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org



More information about the nginx mailing list