httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joshua Slive" <jos...@slive.ca>
Subject Re: [users@httpd] URL redirection based on client's IP address
Date Sat, 01 Jul 2006 19:26:26 GMT
On 7/1/06, Stephane Nicoll <stephane.nicoll@gmail.com> wrote:
> Hi,
>
> I am configuring two maven repositories on two sites using maven
> proxy[1]. The sites are in two different countries with a 1Mbps line
> between them so I need to make sure that requests are localized.
>
> So far I have the following setup on both sites
>
> - Apache2 (80)  w/ Tomcat 5.5 (8080)
> - The following configuration for the virtual host
>
> <VirtualHost *:80>
>     ServerName maven-yy.xxx.com
>     ServerAlias  maven-yy.xxx.com
>     ServerAdmin sni@xxx.com
>     DocumentRoot d:/www/maven.xxx.com
>     ErrorLog logs/maven.xxx.com-error.log
>     CustomLog logs/maven.xxx.com-access.log common
>
>     ProxyRequests Off
>     <Proxy *>
>         Order deny,allow
>         Allow from all
>     </Proxy>
>
>     ProxyPass / http://maven-yy.xxx.com:8080/
>     ProxyPassReverse / http://maven-yy.xxx.com:8080/
>     <Location />
>         Order allow,deny
>         Allow from all
>     </Location>
> </VirtualHost>
>
> Where yy is the country code. So I have actually two repositories
> maven-be.xxx.com and maven-lu.xxx.com.
>
> The idea is to put a simple virtual host, maven.xxx.com that would
> redirect to maven-be.xxx.com or maven-lu.xxx.com based on the client's
> IP address. That way the heavy traffic is localized and using the
> country's cache.
>
> I've searched the list and found an interesting thread[2] but I am
> unable to update it to my configuration.
>
> Can anyone provide help or confirm which mod should I use
> (mod_rewrite, mod_proxy, ...)

Get rid of the ProxyPass directive and use
RewriteEngine On
RewriteCond %{REMOTE_ADDR} regex-matching-lu
RewriteRule (.*) http://maven-lu.xxx.com$1 [R,L]
RewriteRule (.*) http://maven-be.xxx.com$1 [P]

Use the RewriteLog to debug.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message