Forum Moderators: phranque
We are using IBM HTTP Server (Build on Apache) for our production site. I have a strange requirement to route requests from a pre-defined client to another URL. For example, request from 198.2.1.* to [10.10.11.117....] Is it possible to route request based on client IP?
Thanks & Regards,
Sridhar H
try the following in the .htaccess file:
Options +FollowSymlinks
rewriteEngine on
rewriteCond %{REMOTE_ADDR} 198.2.1.*
rewriteRule (.*) [10.10.11.117...] [R=301,L]
Your suggestion works .. I designed my configuration as below.
<VirtualHost *:80>
ProxyRequests Off
RewriteEngine on
RewriteLog /opt/IBMIHS/logs/rewrite.txt
RewriteLogLevel 2
rewriteCond %{REMOTE_ADDR} 198.2.1.*
ProxyPass / [10.10.11.117...]
ProxyPassReverse / [10.10.11.117...]
</VirtualHost>
I am trying to route request only from the given client (remote) IP Address to move to 10.10.11.117. Other request should take the default way. But, my above condition is not working. Request from all clients are routed to the 10.10.11.117 server.
Any help would be appreciated.
Thanks & Regards,
Sridhar H
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} 198.2.1.*
RewriteRule ^(.*) [10.10.11.117...] [P,L]
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^198\.2\.1\.
RewriteRule ^/(.*) http://10.10.11.117/$1 [P,L]
Defining a forward proxy without fully-securing your server is very dangerous, and should be done only if absolutely required.
Jim