httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <>
Subject Re: [users@httpd] mod_rewrite: Overwriting REMOTE_ADDR with HTTP_X_FORWARDED_FOR
Date Fri, 24 Jun 2005 13:49:14 GMT
On 6/24/05, Werner Schalk <> wrote:
> Hi,
> 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:

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

I already explained to you that you can't do this:
Is there some part of that you didn't understand?

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

This is broken because it is trying to rewrite to the URL "[env...". 
You need a dash after the patter to indicate that no rewriting will
occur.  But as I've already told you, it won't work anyway.


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