On Fri, 23 Jun 2000, Steve van der Burg wrote:
> Taking your remote_ip hint, and reading the Eagle a bit more closely,
> I came up with this:
>
> In httpd.conf:
>
> <Location /cgi-bin/VENDOR>
> PerlAccessHandler LHSC::FakeRemoteIP
> </Location>
Why an Access handler? I realize it works, but a more appropriate
phase would be PerlFixupHandler, since you aren't doing any access
control in your module. A couple other nitpicky points: you probably
should return 'DECLINED' at the end, not 'OK', in case there are more
handlers that want to do something during that phase and it also probably
would be a good idea to restore the "real" address after so your logs
show the actual client IP. Something like this:
package FakeIP;
use strict;
use Apache::Constants 'DECLINED';
sub handler {
my $r = shift;
$r->notes('true_client_ip', $r->connection->remote_ip);
$r->connection->remote_ip('1.2.3.4');
$r->push_handlers('PerlLogHandler' =>
sub {
my $r = shift;
$r->connection->remote_ip($r->notes('true_client_ip'));
return DECLINED;
}
);
return DECLINED;
}
1;