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

I took a look at mod_extract_forwarded. I'm not ready yet to move everything to mod_perl 2.0 yet, at least not until the 1.x compatibility mode works. I set mod_rpaf to treat 10.0.0.50 as a proxy server, but now the remote IP I want doesn't show up in the headers. Sigh.
  • Comment on Re^6: HTTP::Proxy and X-Forwarded-For headers

Replies are listed 'Best First'.
Re^7: HTTP::Proxy and X-Forwarded-For headers
by tachyon (Chancellor) on Sep 14, 2004 at 06:07 UTC

    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

      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!