You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by K Anand <ka...@sail-steel.com> on 2007/09/28 08:59:17 UTC
[users@httpd] Reverse Proxy - Client IP
I'm using apache 1.3.xx...I know it is way too old...
My situation is as follows :
Client <-----> Apache <------------> Apache
(Rev Proxy) (Backend)
I have got access to CGI env vars on the Backend apache in my application. I
would like to get the client IP there.
I have tried this :
SetEnv REMOTE_IDENT %{X-Forwarded-For}i
and tried to access REMOTE_IDENT in my application...But i get
%{X-Forwarded-For}i and not the value ...
Any help would be great .
Anand
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Reverse Proxy - Client IP
Posted by Joshua Slive <jo...@slive.ca>.
On 9/29/07, K Anand <ka...@sail-steel.com> wrote:
> I finally managed to get the client IP. I had to use
> mod_proxy_add_forward.c and
> mod_rpaf ....
Ahhh, that's because you're using the obsolete 1.3. It is set in 2.x.
>
> X-Forwarded-For header was not getting set. So I had to use
> mod_proxy_add_forward.c .
> Once that header got set, my app was not able to use it directly. As I had
> written earlier,
> my app can see only CGI vars...So then had to use mod_rpaf to move
> X-Forwarded-For into Remote IP.
All HTTP request headers are converted to CGI variables.
(X-Forwarded-For would become X_FORWARDED_FOR.)
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Reverse Proxy - Client IP
Posted by K Anand <ka...@sail-steel.com>.
>
>> On 9/28/07, K Anand <ka...@sail-steel.com> wrote:
>>> I'm using apache 1.3.xx...I know it is way too old...
>>> My situation is as follows :
>>>
>>> Client <-----> Apache <------------> Apache
>>> (Rev Proxy) (Backend)
>>>
>>> I have got access to CGI env vars on the Backend apache in my
>>> application. I
>>> would like to get the client IP there.
>>>
>>> I have tried this :
>>>
>>> SetEnv REMOTE_IDENT %{X-Forwarded-For}i
>>>
>>> and tried to access REMOTE_IDENT in my application...But i get
>>> %{X-Forwarded-For}i and not the value ...
>>
>> SetEnv can't do that. SetEnvIf might be able to (with a suitable
>> change in syntax -- see the docs), or you could use mod_rewrite. But
>> why are you bothering? Your application should be able to directly
>> access X-Forwarded-For.
>>
>> (Also, careful using X-Forwarded-For because it could contain more
>> than one IP address in the case of a chain of proxies.)
>>
>> Joshua.
>
> I did try to use X-Forwarded-For directly. But I did not get any value
> there.
>
> Anand
I finally managed to get the client IP. I had to use
mod_proxy_add_forward.c and
mod_rpaf ....
X-Forwarded-For header was not getting set. So I had to use
mod_proxy_add_forward.c .
Once that header got set, my app was not able to use it directly. As I had
written earlier,
my app can see only CGI vars...So then had to use mod_rpaf to move
X-Forwarded-For into Remote IP.
Anand
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Reverse Proxy - Client IP
Posted by K Anand <ka...@sail-steel.com>.
----- Original Message -----
From: "Joshua Slive" <jo...@slive.ca>
> On 9/28/07, K Anand <ka...@sail-steel.com> wrote:
>> I'm using apache 1.3.xx...I know it is way too old...
>> My situation is as follows :
>>
>> Client <-----> Apache <------------> Apache
>> (Rev Proxy) (Backend)
>>
>> I have got access to CGI env vars on the Backend apache in my
>> application. I
>> would like to get the client IP there.
>>
>> I have tried this :
>>
>> SetEnv REMOTE_IDENT %{X-Forwarded-For}i
>>
>> and tried to access REMOTE_IDENT in my application...But i get
>> %{X-Forwarded-For}i and not the value ...
>
> SetEnv can't do that. SetEnvIf might be able to (with a suitable
> change in syntax -- see the docs), or you could use mod_rewrite. But
> why are you bothering? Your application should be able to directly
> access X-Forwarded-For.
>
> (Also, careful using X-Forwarded-For because it could contain more
> than one IP address in the case of a chain of proxies.)
>
> Joshua.
I did try to use X-Forwarded-For directly. But I did not get any value
there.
Anand
---------------------------------------------------------------------
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Reverse Proxy - Client IP
Posted by Joshua Slive <jo...@slive.ca>.
On 9/28/07, K Anand <ka...@sail-steel.com> wrote:
> I'm using apache 1.3.xx...I know it is way too old...
> My situation is as follows :
>
> Client <-----> Apache <------------> Apache
> (Rev Proxy) (Backend)
>
> I have got access to CGI env vars on the Backend apache in my application. I
> would like to get the client IP there.
>
> I have tried this :
>
> SetEnv REMOTE_IDENT %{X-Forwarded-For}i
>
> and tried to access REMOTE_IDENT in my application...But i get
> %{X-Forwarded-For}i and not the value ...
SetEnv can't do that. SetEnvIf might be able to (with a suitable
change in syntax -- see the docs), or you could use mod_rewrite. But
why are you bothering? Your application should be able to directly
access X-Forwarded-For.
(Also, careful using X-Forwarded-For because it could contain more
than one IP address in the case of a chain of proxies.)
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@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org