I have these config in my server block:

proxy_intercept_errors on;
error_page 502 =503 /500.html;
error_page 503 =503 /503.html;

location / {

    try_files   $uri $uri/ @node;
    error_page  403 = @node;


From my testing, it appear to work for most path, except http://domain.com/ itself.

I knew of recursive_error_pages but isn't sure about enabling it, is there any gotcha like infinite loop i need to look out for? Or should I modify error_page in the location block instead?

My location block basically tell nginx to handle both file and directory, but redirect directory path to upstream if it doesn't have a default index file.


It would seem like using recursive_error_pages should be completely safe, because there is still a limit of 10 internal redirects per request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.