Re: [users@httpd] URL redirection based on client's IP address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/1/06, Stephane Nicoll <stephane.nicoll@xxxxxxxxx> 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@xxxxxxx
    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@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux