Unexpected error response
    hutchiko 
    nginx-forum at nginx.us
       
    Mon Oct 18 04:32:32 MSD 2010
    
    
  
I'm using Nginx as a front end proxy and have some config that checks
for a file called /maintenance.html and shows that if it's present. 
As our app is quite Ajaxy I would like return a 503 status when the
/maintenance.html page is served up so that the client app can do some
smarts to make things a bit more friendly for the end user.
This is the config that I currently have:
[code]
recursive_error_pages on;
				
location / {
	return 503;
	error_page 503 @tryMaintenance;
}
		
location @tryMaintenance {			
	try_files /maintenance.html /tomcat_stopped.html
@resetResposeCodeAndForwardToRevolve;			
}		
location @resetResposeCodeAndForwardToRevolve {
	return 400;
	error_page 400 = @forwardToRevolve;
}
location @forwardToRevolve {
	proxy_pass http://revolve:2080;
	error_page 502 504 @serverDown;
}
location @serverDown {
	rewrite .* /server_down.html;
}
[/code]
However when the maintenance.html file is not present I end up getting
the generic Nginx 503 error rather than the request getting forwarded on
to my backend server as I expected.
So I guess my question is -   is this a bug or am I simply pushing the
boundaries of what is possible using error_page as a flow control
mechanism?
As an aside if I modify the location @tryMaintenance to the following,
the config does work even though they are basically the same.
[code]	
location @tryMaintenance {			
	try_files /maintenance.html /tomcat_stopped.html =400;
        error_page 400 = @forwardToRevolve;		
}
[/code]
Thanks
Oliver
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,141722,141722#msg-141722
    
    
More information about the nginx
mailing list