Configure specific upstream node to spit 30x error

Maxim Dounin mdounin at mdounin.ru
Wed Aug 15 20:12:56 UTC 2012


Hello!

On Wed, Aug 15, 2012 at 02:52:09PM -0400, TECK wrote:

> Hi all,
> 
> I was wondering if there is feasible way to have a node spit a specific 30x
> error (i.e. 307) if it becomes unreachable, instead of passing to next
> upstream node?
> 
> upstream mycluster {
> server 192.168.1.2;
> server 192.168.1.3;
> server 192.168.1.4;
> }
> 
> If node 192.168.1.3 is down, it should return a 307, instead of passing to
> 192.168.1.4.

Something like this should work:

    error_page 502 504 =307 http://example.com/;
    proxy_next_upstream off;

See here for details:

http://nginx.org/r/error_page
http://nginx.org/r/proxy_next_upstream

Maxim Dounin



More information about the nginx mailing list