Internal marked 503 error page returns default 404

Ádám Joó ajoadam at gmail.com
Sat Aug 22 02:31:35 UTC 2015


Hi,

I have the following configuration:

    server {
        location = /unavailable.html {
            internal;
        }

        try_files $uri =503;

        error_page 503 /unavailable.html;
    }

My goal is to have all existing files with the exception of
unavailable.html served with 200, and serving unavailable.html with
503 for anything else and itself.

The location is marked as internal because otherwise a direct request
for /unavailable.html would result in a 200. The expectation is that
on a direct request it would be deemed non-existent by try_files, so a
503 would be issued, and through an internal redirect unavailable.html
would eventually be served.

Requesting /unavailable.html, however, results in the default 404
served, which is, after all, consistent with the documentation, but is
not what one would expect it to do.

The exact same problem was stated in a Server Fault question in 2011,
but it was never answered
http://serverfault.com/questions/230433/nginx-error-page-and-internal-directives-not-working-as-expected

Can anyone please shed some light on this?


Thanks,
Ádám



More information about the nginx mailing list