subrequest failover

Maxim Dounin mdounin at mdounin.ru
Fri Jul 30 23:58:16 MSD 2010


Hello!

On Wed, Jul 28, 2010 at 05:36:11PM -0700, James Lyons wrote:

> I am trying to use nginx as reverse proxy to perform failover from 1
> critical service to another.
> 
> When processing a request, it sends a request (http GET) to a backend
> (custom http server) using SubRequest methods.  If it is for some
> reason down, and there is no response, i'd like it to fail over to a
> second server.  Is there a way to do this in conf settings or do I
> have to make code modifications to accomplish this?

Subrequests in nginx aren't really different from ordinary 
requests, they are handled in the same way - with location 
matching and so on.  Setting failover correctly in config (either 
with proxy_next_upstream or via error_page) would do the trick for 
both normal requests and subrequests.

Maxim Dounin



More information about the nginx mailing list