No.Here both PHP and CGI scripts can get the X_FORWARDED_FOR ip,but
modperl can't.Is the %ENV hash not useful under modperl?

2007/8/3, Torsten Foertsch <[EMAIL PROTECTED]>:
> On Friday 03 August 2007 12:29, Jen mlists wrote:
>
> > I meet a problem about getting client's original IP.
> > Some clients use proxy servers to access our sites,and I need to get
> > their original IPs instead of proxy servers' IPs.
> >
> > In CGI I can write it like:
> >
> > my $ip = $ENV{'HTTP_X_FORWARDED_FOR'} ? $ENV{'HTTP_X_FORWARDED_FOR'} :
> > $c->remote_ip;
>
> This idea won't work in general. First, not all proxies set an X-Forwarded-For
> header. Second, many proxies sit in front of private networks 10.0.0.0/8 or
> 172.16.0.0/16 or 192.168.0.0/16 or 127.0.0.0/8. If they set the header you
> get different clients with the same IP-address. Also, be aware that a request
> can travel through multiple proxies. Thus, you can get multiple
> X-Forwarded-For headers.
>
> That said, you can access all incoming headers via
> $r->headers_in->{$header_name}.
>
> Torsten
>
>

Reply via email to