Nginx load balancer with GeoIP

Glen Lumanau glen at lumanau.web.id
Wed Nov 12 12:03:57 MSK 2008


Thank's Igor it's works successfull.

Onother question is, are we using the Load Balancer bandwidth also to send
the data to the client?
Because what we do is, I'm mirroring the server in my country, and I have
onother server which is located in US

Also, I already install mod_rpaf on the apache, and set
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://$geo.server$request_uri;

But what I received on the apache logs, is still the load balancer IP, not
the public IP


Regards,

Glen Lumanau


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

On Wed, Nov 12, 2008 at 02:49:10PM +0700, Glen Lumanau wrote:

> 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;

-         proxy_pass http://$geo.server;
+         proxy_pass http://$geo.server$request_uri;

> 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/
> 

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






More information about the nginx mailing list