Jonathan Vanasco wrote:
my mp2 needs to get the ip of the remote address
on some installations, mp2 is on port 80
on other installations, mp2 is on 80xx and the ip is in X-Forwarded-For
You could re-write the remote IP at an early stage - add a
PerlFixupHandler or PerlTransHandler which goes something like (assuming
its IPv4!):
sub handler { my $r=shift;
if($r->headers_in->{'X-Forwarded-For'} =~/(\d+\.\d+\.\d+\.\d+)/){
$r->remote_ip($1);
}
return DECLINED; # let other handlers run too
}
Remember your proxy might be just be adding to an existing
x-forwarded-for header if the user already came from a proxy, so adjust
the regex to pick the right IP - it's probably the first one in a comma
separated list if all the proxies are well behaved but remember it's a
non-standard header.
John