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

This proxy is making the connection to Apache. As such its IP is the remote_ip as far as Apache is concerned. See mod_extract_forwarded link that explains this and how to get Apache to accept the first non truscted proxy in the X-Forwarded-For list as the remote_ip.

cheers

tachyon

  • Comment on Re^5: HTTP::Proxy and X-Forwarded-For headers

Replies are listed 'Best First'.
Re^6: HTTP::Proxy and X-Forwarded-For headers
by cleverett (Friar) on Sep 14, 2004 at 05:15 UTC
    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.

      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!