sub My::ProxyRemoteAddr ($) { my $r = shift; return Apache::Constants::OK unless ($r->connection->remote_ip eq "127.0.0.1") and $r->header_in('X-Forwarded-For') and $r->header_in('X-Forwarded-Host'); if (my ($ip) = $r->header_in('X-Forwarded-For') =~ /([^,\s]+)$/) { $r->connection->remote_ip($ip); } if (my ($fh) = $r->header_in('X-Forwarded-Host') =~ /([^,\s]+)$/) { $r->header_in('Host',$fh); } return Apache::Constants::OK; }