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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to