Nginx load balancer with GeoIP

Glen Lumanau glen at lumanau.web.id
Wed Nov 12 10:49:10 MSK 2008


When using it for HTTP request, it show me error on my browser

Bad Request

Your browser sent a request that this server could not understand.

Here's my configuration

    geo $geo {
        default default;
	  include geo.conf;
    }

    upstream ID.server {
        server 10.50.12.123;
    }

    upstream default.server {
        server 1.2.3.4;
    }

server {
    listen          10.50.12.134:80;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_pass http://$geo.server;

Anyone know how to fix this?


Regards,

Glen Lumanau


-----Original Message-----
From: owner-nginx at sysoev.ru [mailto:owner-nginx at sysoev.ru] On Behalf Of Igor
Sysoev
Sent: 11 Nopember 2008 13:40
To: nginx at sysoev.ru
Subject: Re: Nginx load balancer with GeoIP

On Tue, Nov 11, 2008 at 10:10:42AM +0700, Glen Lumanau wrote:

> Is nginx will support load balancing with GeoIP support?
> 
>  
> 
> Example :
> 
> If match country US
> 
>                 Proxy_pass http://us.server/;
> 
> If match other
> 
>                 Proxy_pass http://default.server/;

http {
      geo  $geo  {
         default      default;
         1.1.1.0/24   us;
         1.1.2.0/24   us;
         1.1.3.0/24   us;
         ...
      }

      upstream  us.server {
          ....
      }

      upstream  default.server {
          ....
      }

      server {
           location / {
               proxy_pass  http://$geo.server;
           }


-- 
Igor Sysoev
http://sysoev.ru/en/






More information about the nginx mailing list