in reply to Re^6: HTTP::Proxy and X-Forwarded-For headers
in thread HTTP::Proxy and X-Forwarded-For headers

Why not just use the logic for fingering the remote IP as detailed before. In Apache syntax it would be:

my $ip = $r->headers_in->get('X-Forwarded-For') || $r->get_remote_host() || $r->connection->remote_ip(); ($ip) = split /\s*,/, $ip;

cheers

tachyon

Replies are listed 'Best First'.
Re^8: HTTP::Proxy and X-Forwarded-For headers
by cleverett (Friar) on Sep 14, 2004 at 06:34 UTC
    Heh, I did just about the same thing:
    sub get_remote_ip { my ($class, $apr) = @_; my @ips = split(/\s*,\s*/, ($apr->header_in('X-Forwarded-For') + || $apr->get_remote_host() || $apr->connection->remote_ip())); return shift @ips; }
    Works fine now! 1 bug down, uptitty-ump more to go!