Proxy requests return 404 when backends down how to return appropriate 50x error?

Igor Sysoev is at
Sat Dec 30 10:34:10 MSK 2006

On Fri, 29 Dec 2006, Ezra Zygmuntowicz wrote:

> 	I am using a standard nginx config for proxying to mongrel for rails 
> apps. I have this for error pages:
>    error_page   500 502 503 504  /50x.html;
>    location = /50x.html {
>      root   html;
>    }
> 	But when my backend mongrels are down nginx always returns a 404 
> instead of a 500x error. Do I need to catch the 404 from proxy going down and 
> show my own error? Or is there something I am missing. Do all failed proxy 
> requests return 404 instead of 502 or 503?

Look error_log, there should be the error lines:

"... [error] ... open() ".../html/50x.html" failed (2: No such file
or directory), ..."

You need to place the "/50x.html" page here or set another "root" for it.

Igor Sysoev

More information about the nginx mailing list