View Full Version : Squid and HTTP Headers
spazeman
Wed 20th Nov '02, 11:54pm
I'm running squid now on my new server and since i've loaded vB last week, i'm having problems with headers. namely i need to get vBulletin code too use HTTP_X_FORWARDED_FOR instead of REMOTE_ADDR.
any ideas?
i am assuming i have to edit the 'get session' lines in infoadmin/sessions.php...
:confused:
fastforward
Thu 21st Nov '02, 3:19am
If you're using Apache, try mod_proxy_add_forward.
I used it with fat mod_perl apache backend running mod_proxy and a thin apache front end running mod_proxy_add_forward.
Basically, it converts the headers for you
It should work with Squid, but I can't promise you.
You'll need to create a Perl script called proxy_conf.pl or something:
use Apache::Constants ();
sub My::ProxyRemoteAddr ($) {
my $r = shift;
# we'll only look at the X-Forwarded-For header if the requests
# comes from our proxy at localhost
return Apache::Constants::OK
unless ($r->connection->remote_ip eq "127.0.0.1")
and $r->header_in('X-Forwarded-For');
# Select last value in the chain -- original client's ip
if (my ($ip) = $r->headers_in->{'X-Forwarded-For'} =~ /([^,\s]+)$/) {
$r->connection->remote_ip($ip);
}
return Apache::Constants::OK;
}
1;
and then load it from httpd.conf
PerlRequire /etc/httpd/conf/proxy_conf.pl
vBulletin® v3.8.0 Release Candidate 1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.