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

Francis Daly francis at
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
> set_real_ip_from;

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

Are you aware that means "10.0.0.anything"?

If you want "10.anything", that is

> 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:' http://localhost:8080/

shows "" 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,

Francis Daly        francis at

More information about the nginx mailing list