# Configure specific upstream node to spit 30x error

**URL:** <https://www.ruby-forum.com/t/configure-specific-upstream-node-to-spit-30x-error/222165>\
**Category:** NGINX\
**Created:** [August 15, 2012, 8:52pm UTC](https://www.ruby-forum.com/t/configure-specific-upstream-node-to-spit-30x-error/222165 "2012-08-15T20:52:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [August 15, 2012, 8:52pm UTC](https://www.ruby-forum.com/t/configure-specific-upstream-node-to-spit-30x-error/222165/1 "2012-08-15T20:52:47Z")

</div>

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.

Thank you for your help.

Regards,

Floren

Posted at Nginx Forum:

> **[Configure specific upstream node to spit 30x error](https://forum.nginx.org/read.php?2,229731,229731#msg-229731)**
>
> 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

---

<div class="post-metadata">

**Author:** ![teck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@teck](https://www.ruby-forum.com/u/teck)\
**Post date:** [August 15, 2012, 9:21pm UTC](https://www.ruby-forum.com/t/configure-specific-upstream-node-to-spit-30x-error/222165/2 "2012-08-15T21:21:26Z")

</div>

Just to clarify, my goal is to make sure a php-fpm POST is passed to  
next  
node, if current fails. From my understanding the 307 error is designed  
to  
do this. Thank you.

Posted at Nginx Forum:

> **[Re: Configure specific upstream node to spit 30x error](https://forum.nginx.org/read.php?2,229731,229734#msg-229734)**
>
> 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

---

<div class="post-metadata">

**Author:** ![teck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@teck](https://www.ruby-forum.com/u/teck)\
**Post date:** [August 15, 2012, 10:13pm UTC](https://www.ruby-forum.com/t/configure-specific-upstream-node-to-spit-30x-error/222165/3 "2012-08-15T22:13:28Z")

</div>

Hello!

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

> }
> 
> 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:

> **[Module ngx\_http\_core\_module](http://nginx.org/en/docs/http/ngx_http_core_module.html#error_page)**
>
> This directive appeared in version 1.11.8.

> **[Module ngx\_http\_proxy\_module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream)**
>
> The ngx\_http\_proxy\_module module allows passing requests to another server.

Maxim D.

---

<div class="post-metadata">

**Author:** ![teck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@teck](https://www.ruby-forum.com/u/teck)\
**Post date:** [August 15, 2012, 11:13pm UTC](https://www.ruby-forum.com/t/configure-specific-upstream-node-to-spit-30x-error/222165/4 "2012-08-15T23:13:05Z")

</div>

Thank you, Maxim. Related to second part of my question:  
Will the POST be passed properly to next node, if first one fails? If is  
not, is there a configuration setting that will enable that feature?

Regards,

Floren

Posted at Nginx Forum:

> **[Re: Configure specific upstream node to spit 30x error](https://forum.nginx.org/read.php?2,229731,229737#msg-229737)**
>
> 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

---

<div class="post-metadata">

**Author:** ![teck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@teck](https://www.ruby-forum.com/u/teck)\
**Post date:** [August 16, 2012, 9:38am UTC](https://www.ruby-forum.com/t/configure-specific-upstream-node-to-spit-30x-error/222165/5 "2012-08-16T09:38:48Z")

</div>

There will be a solution of,

Posted at Nginx Forum:

> **[Nginx Forum :: Nginx Mailing List - English](https://forum.nginx.org/read.php?2,229731,229766#msg-229766)**
>
> A portal to and from the mailing list.

---

<div class="post-metadata">

**Author:** ![teck](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b2d939/32.png) [@teck](https://www.ruby-forum.com/u/teck)\
**Post date:** [August 15, 2012, 11:31pm UTC](https://www.ruby-forum.com/t/configure-specific-upstream-node-to-spit-30x-error/222165/6 "2012-08-15T23:31:11Z")

</div>

Hello!

On Wed, Aug 15, 2012 at 05:12:43PM -0400, TECK wrote:

> Thank you, Maxim. Related to second part of my question:  
> Will the POST be passed properly to next node, if first one fails? If is  
> not, is there a configuration setting that will enable that feature?

Once you return 307 redirect to a client - it’s up to a client to  
decide what to do.

If you want nginx to pass requests to a next upstream server, just  
leave proxy\_next\_upstream as set by default to “error timeout”.  
It works for all request methods.

See here for details:

> **[Module ngx\_http\_proxy\_module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream)**
>
> The ngx\_http\_proxy\_module module allows passing requests to another server.

Maxim D.
