nginx load balancer with geoip?

Francis Daly francis at daoine.org
Sun Mar 4 09:23:06 UTC 2012


On Fri, Mar 02, 2012 at 10:46:20PM -0500, delphixe2 wrote:

Hi there,

you've found something that works for you, so you can stay with that
configuration.

However:

> I tried that, and I get 500 Internal Server Error.

I find that it is usually worth understanding *why* configurations fail,
so it might be worth investigating happened there.

> and more lines what I tested :
> proxy_set_header   X-Real-IP  $remote_addr;
> proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

They can be useful if the proxied server is configured to care about them.

> temporarily, I solved problem.
> upstream default.folderfile.net {
> server folderfile.net;
> }
> upstream kr.folderfile.net {
> server nixneo.com;
> }
> 
> location / {
> proxy_pass http://$geo.folderfile.net;
> }
> 
> and I added record for default.folderfile.net -> folderfile.net's server
> IP & kr.folderfile.net -> nixneo.com's IP

Perhaps nixneo.com responds differently based on the source address; but
from where I am, it looks like you have a redirector, not a reverse proxy.

When I access the IP address of nixneo.com, if I make a http request
with anything other than a Host: header of "nixneo.com", I get a 302
redirect to http://nixneo.com/

So to get useful content back in a proxy_pass location, I'd need to set
the correct Host header.

All the best,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list