Apache2-FixRemote
view release on metacpan or search on metacpan
lib/Apache2/FixRemote.pm view on Meta::CPAN
use Apache2::RequestRec ();
use Apache2::Connection ();
use Apache2::Log ();
use Apache2::Const -compile => qw(OK);
use APR::Table ();
=head1 NAME
Apache2::FixRemote - Reset remote IP with contents of X-Forwarded-For header
=head1 VERSION
Version 0.01
=cut
our $VERSION = '0.01';
=head1 SYNOPSIS
lib/Apache2/FixRemote.pm view on Meta::CPAN
# or alternatively use any handler stage after map-to-storage, such as:
<Location /foo>
PerlHeaderParserHandler Apache2::FixRemote
</Location>
=cut
sub handler {
my $r = shift;
my $hdr = $r->headers_in->get('X-Forwarded-For');
if ($hdr and $hdr =~ /^\d+\.\d+\.\d+\.\d+$/) {
my $old = $r->connection->remote_ip($hdr);
$r->log->debug("Changed inbound IP from $old to $hdr");
}
Apache2::Const::OK;
}
=head1 AUTHOR
Dorian Taylor, C<< <dorian at cpan.org> >>
( run in 0.456 second using v1.01-cache-2.11-cpan-26ccb49234f )