httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Werner Schalk <>
Subject [users@httpd] mod_rewrite: Overwriting REMOTE_ADDR with HTTP_X_FORWARDED_FOR
Date Fri, 24 Jun 2005 12:44:32 GMT

I would like to use mod_rewrite to overwrite the environment variable 
REMOTE_ADDR with the value of HTTP_X_FORWARDED_FOR because I am using Apache 
2 in a reverse / forward proxy scenario where the original IP address of the 
client is not passed on to the internal Apache server:

Inet -> Server (public IP, Apache 2) -> Internal Server (same system, virtual 
server using Linux vserver - private IP address, Apache 2)

I have posted this several weeks ago but all the solutions did not work for 
me. So I tried this mod_rewrite rule:

RewriteEngine On
RewriteRule ^(.*) [env=REMOTE_ADDR:%{HTTP_X_FORWARDED_FOR}]

What's wrong with them? Whenever I activate them I get a "Bad request" 
response from my web server. 

Any input is greatly appreciated. Thanks a lot.

All the best & thanks,

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message