# Question on redundant nginx reverse proxy setup

**URL:** <https://www.ruby-forum.com/t/question-on-redundant-nginx-reverse-proxy-setup/197800>\
**Category:** NGINX\
**Created:** [October 20, 2010, 1:09pm UTC](https://www.ruby-forum.com/t/question-on-redundant-nginx-reverse-proxy-setup/197800 "2010-10-20T13:09:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [October 20, 2010, 1:09pm UTC](https://www.ruby-forum.com/t/question-on-redundant-nginx-reverse-proxy-setup/197800/1 "2010-10-20T13:09:36Z")

</div>

Hi,

I’m planning to set up this environment:

±------------+ ±------------+  
| ISP1 | | ISP2 |  
±------------+ ±------------+  
| |  
±------------+ ±------------+  
| FW1/proxy | | FW2/proxy |  
±------------+ ±------------+  
| | | |  
| ±-------------±----------+ |  
| | |  
| switch |  
| | |  
±—±-----------±-------------+  
| |  
switch |  
| |  
| ±--------------+  
| |  
±--------±–+ ±--------±–+  
| www1 | | www2 |  
±------------+ ±------------+

(raw ASCII art at [http://simoncpu.pastebin.com/raw.php?i=0StGLjCk](http://simoncpu.pastebin.com/raw.php?i=0StGLjCk))

Question: Does nginx gurantee, using the NginxHttpUpstreamModule, that  
it will direct incoming connections to the right www server? Would  
the two identical nginx servers create identical IP hashes?

Thanks,

[simon.cpu]

---

<div class="post-metadata">

**Author:** ![Simon\_Cornelius\_P\_U](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/848f3c/32.png) [@Simon\_Cornelius\_P\_U](https://www.ruby-forum.com/u/Simon_Cornelius_P_U)\
**Post date:** [October 20, 2010, 1:48pm UTC](https://www.ruby-forum.com/t/question-on-redundant-nginx-reverse-proxy-setup/197800/2 "2010-10-20T13:48:50Z")

</div>

Hello!

On Wed, Oct 20, 2010 at 07:08:27PM +0800, Simon Cornelius P Umacob  
wrote:

> ±------------+ ±------------+  
> | |  
> ±--------±–+ ±--------±–+  
> | www1 | | www2 |  
> ±------------+ ±------------+
> 
> (raw ASCII art at [http://simoncpu.pastebin.com/raw.php?i=0StGLjCk](http://simoncpu.pastebin.com/raw.php?i=0StGLjCk))
> 
> Question: Does nginx gurantee, using the NginxHttpUpstreamModule, that  
> it will direct incoming connections to the right www server? Would  
> the two identical nginx servers create identical IP hashes?

Do you mean “with ip\_hash directive”? Ip hash is calculated  
from client’s ip address only (first 3 octets of it), so in most  
cases answer is “yes”.

You should be prepared to handle any user request on any backend  
server though (possibly less effectively), due to the fact that  
there are users which change their ips frequently (e.g. mobile  
users or users behind large proxy pools).

For this particular setup there are also multihomed hosts to  
consider which may select different ip addreses while connecting  
to different frontends. But it’s unlikely to be big problem  
compared to already mentioned cases unless your clients are very  
specific.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Simon\_Cornelius\_P\_U](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/848f3c/32.png) [@Simon\_Cornelius\_P\_U](https://www.ruby-forum.com/u/Simon_Cornelius_P_U)\
**Post date:** [October 20, 2010, 2:07pm UTC](https://www.ruby-forum.com/t/question-on-redundant-nginx-reverse-proxy-setup/197800/3 "2010-10-20T14:07:11Z")

</div>

On Wed, Oct 20, 2010 at 7:47 PM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hello!
> 
> Do you mean “with ip\_hash directive”? Ip hash is calculated  
> from client’s ip address only (first 3 octets of it), so in most  
> cases answer is “yes”.

Thanks for the info! I guess nginx with ip\_hash is the right choice  
for our setup.

> You should be prepared to handle any user request on any backend  
> server though (possibly less effectively), due to the fact that  
> there are users which change their ips frequently (e.g. mobile  
> users or users behind large proxy pools).
> 
> For this particular setup there are also multihomed hosts to  
> consider which may select different ip addreses while connecting  
> to different frontends. But it’s unlikely to be big problem  
> compared to already mentioned cases unless your clients are very  
> specific.

I think this problem is inherent to any user who has multiple IPs, so  
this limitation is OK. 🙂

Thanks!

[simon.cpu]
