IP based redirect with mod_rewrite

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

 



Hi

 

How do I set up a rule in Apache( If at all that is possible) to redirect traffic based on the IP address of the client.

 

Here is the set up of the env

 

There is a reverse proxy (F5 LTM) that does SSL offloading and this is the first point the user hits and this does load balancing across our Apache Web Servers.

 

So, we have Apache as a proxy server that sits behind the firewall and this is the second entry point.

 

The problem is I would need to set up a rewrite rule in Apache that diverts user to a web page depending on the original IP address of the client.

 

We run Apache v2 and use {X-Forwarded-For}i feature that enables us to record the IP address of the client in the access log.

 

In the access log I get both  the F5 proxy IP and also the original client IP.

 

wsadmin@dolores:/etc/apache2> rpm -qa | grep apache2

apache2-2.0.49-27.38

apache2-worker-2.0.49-27.38

 

Now the condition and rule

 

As soon as the client hits the F5 and the request is sent to Apache, I need Apache to make a decision by getting the actual client IP and routing to the appropriate web page.

 

Say if the user is accessing a URI /* and the request is coming from within 128.48.0.0/16 or ucop.edu domain

 

I need users to get to https://sseqa.ucop.edu/*

 

For any other client IP requesting the same URI, Apache should make a decision to re route the request to a different site https://--------

 

How do I do that?

 

Any support is appreciated.

 

I tried several ways to establish this but each time it fails. I don’t have the failure logs for one particular attempt.

 

%{REMOTE_ADDR} 

%{HTTP:X-FORWARDED-FOR}

%{REMOTE_HOST}  - When trying for a domain based redirect

 

Thanks

Priya

 

 


[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