Welcome! Log In Create A New Profile

Advanced

Re: ip_hash and real_ip_header

January 25, 2010 07:50PM
Hi,

Laurence Rowe wrote:
> Hi,
>
> I've got Nginx 0.7.64 running as a loadbalancer / transformation proxy
> behind varnish. I'd like to use ip_hash so users get the benefit of
> session affinity on my app servers. Though I seem to have
> real_ip_header setup correctly ($remote_addr is correct as shown by
> X-Real-IP on my app servers), all the requests end up using only a
> single app server. Here's the relevant parts of my config:
>
> http {
> ...
> set_real_ip_from 127.0.0.1;
> real_ip_header X-Forwarded-For;
> ...
> upstream backend {
> ip_hash;
> server 127.0.0.2:5011;
> server 127.0.0.2:5012;
> }
> ...
>
> Should this work?
>
Should do AFAICT. Have you tried compiling with debug on - information
about IP addresses is given if you have debug_http set in the config file?

Have you tried round-robin to check that both servers work that way?

btw, if you don't need to have a trace of all the IP addresses of the
servers, using X-Real-IP as the 'real_ip_header' is marginally quicker
than X-Forwarded-For.

Marcus.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

ip_hash and real_ip_header

Laurence Rowe January 25, 2010 06:26PM

Re: ip_hash and real_ip_header

Eugaia January 25, 2010 07:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 242
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready