"error_page"& "return" bug?
Nginx User
nginx at nginxuser.net
Sun Feb 19 15:06:54 UTC 2012
On 19 February 2012 17:46, Edho Arief <edho at myconan.net> wrote:
> On Sun, Feb 19, 2012 at 9:01 PM, Nginx User <nginx at nginxuser.net> wrote:
>>> What's the problem with placing return 503 in location / { } block?
>>
>> None whatsoever. Did anyone say there was one?
>>
>
> Just wondering. Also I couldn't make the method with rewriting work. I
> got 302'd ad infinitum.
That'll be because none of the code I posted is actually real. They
were just to help get an answer.
This is what actually works:
Server {
error_page 503 /error_docs/custom503.html;
if ( $request_uri !~ \.(jpg|gif|png|css|js)$ ) {
set $tt "T";
}
if ( $request_uri !~ ^/maintenance/$ ) {
set $tt "${tt}T";
}
if ( $tt = TT ) {
rewrite ^ /maintenance/ redirect;
}
location /maintenance {
internal;
return 503;
}
location /error_docs {
internal;
alias /server/path/to/503_status/folder;
}
}
More information about the nginx
mailing list