You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Daisuke Maki <da...@wafu.ne.jp> on 2003/04/21 08:44:02 UTC

ip address from frontend server

When you have your usual

   Client -> Front End (proxy) -> Back End (modperl)

setup, is there a way to reliably get the ip address of the client from
the modperl server?

--d


Re: ip address from frontend server

Posted by Neil Nelson <ne...@dslextreme.com>.
Ged Haywood,

Thank you for your replies of yesterday.  Two days ago I
realized that it was very likely that Apache/mod_perl (1.0)
was the path leading to a very near-term production server
and have just managed to get that software working with
mysql this morning, and I am having good success with the
tutorial docs. A not too obvious part of the sequence seems
to be installing Request.pm and others via

perl -MCPAN -eshell
pan>force install Bundle::Apache

The tone of my prior posts suggested some frustration at
the Apache/mod_perl (2.0) context which though now
seems obviously developmental, previously seemed the
better choice because of having Apache2 running for
some time, RedHat was distributing it with their latest
release, and the perl.apache docs seemed to suggest a
good probability of success.

But I nevertheless look forward to the continued work on
mod_perl 2.0 and realize that significant systems like this
require a long development period with good participation.

Regards,

Neil Nelson




Re: ip address from frontend server

Posted by Thomas Eibner <ei...@mnmailhost.bridge.com>.
On Mon, Apr 21, 2003 at 10:45:31AM -0700, Daisuke Maki wrote:
> 
> >Because of things like NAT, over which you have no control, the IP
> >address of the client doesn't reliably reach the FRONT end server.
> >It's not even guaranteed to stay the same over the course of what you
> >might think of as a session.
> 
> Yeah, I just want to make sure that I have whatever the FE server thinks 
> is the client IP address.
> 
> >However, if you're determined to try, then you can check out chat on
> >this List about mod_proxy_add_forward (which is no longer needed, I
> >understand, as the functionality is integrated into the Apache source
> >as of about 1.3.26).
> 
> I'm using 2.0.45 for the FE server, but I couldn't immediately see any 
> directive that may add RemoteIP to some header.
> 
> However, it looks like I could just use X-Forwarded-For, since
> 
>   (a) I'm guaranteed that the last-in-chain of proxies is my FE server
>   (b) the source says
> 
>    /* Add X-Forwarded-For: so that the upstream has a chance to
>     * determine, where the original request came from.
>     */
>    apr_table_mergen(r->headers_in, "X-Forwarded-For",
>                   r->connection->remote_ip);
> 
> ...which is exactly the value that I wanted. Because of these two 
> reason, I should be able to split() X-Forwarded-For and look for the 
> last X-Forwarded-For entry, I think. Pls let me know if this is not the 
> case....

I made a module that would do this in C, so you could have a ton of
virtualhosts go to the same backend server without passing all sorts
of stuff in the request. http://stderr.net/apache/rpaf/


Re: ip address from frontend server

Posted by Daisuke Maki <da...@wafu.ne.jp>.
> Because of things like NAT, over which you have no control, the IP
> address of the client doesn't reliably reach the FRONT end server.
> It's not even guaranteed to stay the same over the course of what you
> might think of as a session.

Yeah, I just want to make sure that I have whatever the FE server thinks 
is the client IP address.

> However, if you're determined to try, then you can check out chat on
> this List about mod_proxy_add_forward (which is no longer needed, I
> understand, as the functionality is integrated into the Apache source
> as of about 1.3.26).

I'm using 2.0.45 for the FE server, but I couldn't immediately see any 
directive that may add RemoteIP to some header.

However, it looks like I could just use X-Forwarded-For, since

   (a) I'm guaranteed that the last-in-chain of proxies is my FE server
   (b) the source says

    /* Add X-Forwarded-For: so that the upstream has a chance to
     * determine, where the original request came from.
     */
    apr_table_mergen(r->headers_in, "X-Forwarded-For",
                   r->connection->remote_ip);

...which is exactly the value that I wanted. Because of these two 
reason, I should be able to split() X-Forwarded-For and look for the 
last X-Forwarded-For entry, I think. Pls let me know if this is not the 
case....

--d


Re: ip address from frontend server

Posted by Ged Haywood <ge...@www2.jubileegroup.co.uk>.
Hi there,

On Sun, 20 Apr 2003, Daisuke Maki wrote:

> When you have your usual
> 
>    Client -> Front End (proxy) -> Back End (modperl)
> 
> setup, is there a way to reliably get the ip address of the client from
> the modperl server?

No.

Because of things like NAT, over which you have no control, the IP
address of the client doesn't reliably reach the FRONT end server.
It's not even guaranteed to stay the same over the course of what you
might think of as a session.

However, if you're determined to try, then you can check out chat on
this List about mod_proxy_add_forward (which is no longer needed, I
understand, as the functionality is integrated into the Apache source
as of about 1.3.26).

73,
Ged.