Stud -> Haproxy -> and Nginx; nginx real_ip_header isn't working as expected, can't scale

Francis Daly francis at daoine.org
Fri Aug 31 22:34:45 UTC 2012


On Fri, Aug 31, 2012 at 11:32:13AM -0700, Thompson, Paige wrote:

Hi there,

> I only have one load balancer at the moment, but given the addition of
> a second or third in which I cannot rely on all of the ip addresses to
> be expressible any other way than 0.0.0.0/24.
> 
> set_real_ip_from   10.0.0.0/24;

You've used two different cidr addresses there. It's not clear which
one you actually mean.

Are you aware that 10.0.0.0/24 means "10.0.0.anything"?

If you want "10.anything", that is 10.0.0.0/8.

> real_ip_header X-Forwarded-For;
> 
> This simply does not work, however if I put a single load balancers IP
> address there, it does.

It looks to me like it should work.

And a quick test of

curl -i -H 'X-Forwarded-For: 10.0.1.99' http://localhost:8080/

shows "10.0.1.99" as the first field in access.log.

What does your set_real_ip_from directive say? And what is the IP address
of the load balancer that is talking to nginx?

I suspect that when you configure it right, nginx will work fine.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list