Kip says:
>
> I currently use a module written by Ask Bjoern Hansen called
> proxy_add_forward.
>
> Compiling this into your proxy server adds an X-Forwarded-For header to the
> proxy requests which contains the ip of the client you're interested in.
>
> You can find that module here
>
> http://modules.apache.org/search?id=124
>
> and probably a host of other places.
Dave-
Here's a copy of my specific instructions on adding IP logging to the
app server:
In mod_perl dir:
perl Makefile.PL \
APACHE_SRC=../apache_1.3.12/src \
DO_HTTPD=1 \
USE_APACI=1 \
PREP_HTTPD=1 \
EVERYTHING=1
copy mod_proxy_add_forward.c to apache_1.3.12/ dir
in apache_1.3.12 dir:
OPTIM="-O3 -m486" \
./configure --prefix=/usr \
--with-layout=RedHat \
--add-module=mod_bandwidth.c \
--add-module=mod_proxy_add_forward.c \
--enable-module=most \
--enable-shared=max \
--disable-rule=WANTHSREGEX \
--disable-module=auth_dbm \
--disable-module=auth_db \
--activate-module=src/modules/perl/libperl.a \
--with-perl=/usr/bin/perl
(notice the --add-module=mod_proxy_add_forward.c line)
(you probably don't want all of the other lines)
In the httpd.conf for the proxy server:
(add at the end of LoadModule statements:)
LoadModule proxy_add_forward_module modules/mod_proxy_add_forward.so
(add at the end of the AddModule statements:)
AddModule mod_proxy_add_forward.c
now your proxy server will send the X-Forwarded-For header. But the app
server needs to take that header and treat it as the originating ip.
In the startup.pl of the app server:
sub My::ProxyRemoteAddr ($) {
my $r = shift;
if (my ($ip) = $r->header_in('X-Forwarded-For') =~ /([^,\s]+)$/) {
$r->connection->remote_ip($ip);
}
return OK;
}
and in your httpd.conf file, somewhere:
# move X-Forwarded-For ip into r->connection->remote_ip
PerlPostReadRequestHandler My::ProxyRemoteAddr
-Tim