Mailing List Archive

Squid + Apache only logging client 127.0.0.1?
Howdy,

I'm running Squid 2.5 (as http_accellerator), Apache 2.0.52 and
Mediawiki 1.3.8. My original setup (/wiki/index.php/...) used to
work brilliantly, but I have rearranged stuff so it runs nicely
without the "/wiki" or "/index.php/" bit. Works like a charm on
first sight.

On closer inspection, everyones client IP-address is "127.0.0.1",
which matches the Apache access_log. The Squid access_log displays
the client IP-address correctly, so my guess would be that Squid
somehow doesn't pass on the client IP address. The strange thing
is that I could swear that I didn't touch Squid's settings or
restarted it and it passed on the right IP address just fine
before I started fiddling with the Apache setup. So logic would
dictate it is something in Apache... But disabling all RewriteRules
does not bring back the correct client IP-addresses, which seems
to point the finger back to Squid...

Can anyone hint me where to start looking, or does anyone recognize
these symptoms? I've been up and down the squid.conf and httpd.conf,
but most settings make perfect sense.

Greetings,

Patrick

--
_______________________________________________________________
Patrick Atoon ___________________ mailto:patricka@rapdict.org
_____________________________________ http://www.rapdict.org/
Re: Squid + Apache only logging client 127.0.0.1? [ In reply to ]
On Dec 2, 2004, at 12:50 PM, Patrick Atoon wrote:
> I'm running Squid 2.5 (as http_accellerator), Apache 2.0.52 and
> Mediawiki 1.3.8. My original setup (/wiki/index.php/...) used to
> work brilliantly, but I have rearranged stuff so it runs nicely
> without the "/wiki" or "/index.php/" bit. Works like a charm on
> first sight.
>
> On closer inspection, everyones client IP-address is "127.0.0.1",
> which matches the Apache access_log.

Make sure you've enabled squid mode in MediaWiki... this will tell it
to use the forwarded address (in the X-Forwarded-For header) instead of
the direct remote address (which is going to be the squid), and to make
anonymous page views cacheable by the squid so you actually get some
benefit out of it.

$wgUseSquid = true;
$wgSquidServers = array('127.0.0.1');

Localhost needs to have the privilege to issue PURGE requests to the
squid in order to clear cached pages when they update. (You might or
might not also have to fiddle with $wgInternalServer, which controls
the base URL on the PURGE requests; it should match whatever the squid
thinks it's saving, iirc.)

-- brion vibber (brion @ pobox.com)
Re: Squid + Apache only logging client 127.0.0.1? [ In reply to ]
Brion Vibber wrote:

> Patrick Atoon wrote:
>
> > On closer inspection, everyones client IP-address is "127.0.0.1",
> > which matches the Apache access_log.
>
> Make sure you've enabled squid mode in MediaWiki... this will tell it to
> use the forwarded address (in the X-Forwarded-For header) instead of the
> direct remote address (which is going to be the squid), and to make
> anonymous page views cacheable by the squid so you actually get some
> benefit out of it.
>
> $wgUseSquid = true;
> $wgSquidServers = array('127.0.0.1');

Ah! That was it, it works again. Thanks again for your help, Brion.

As a small token of my appreciation, I have organized my findings
on setting up Squid + Apache + MediaWiki in a new setup article that
I found missing on the System Administrators setup page:

http://meta.wikimedia.org/w/wiki.phtml?title=Squid_caching

Everyone who feels up to it, please review the article to see if it
isn't too far from the truth. ;-)

Greetings,

Patrick

--
_______________________________________________________________
Patrick Atoon ___________________ mailto:patricka@rapdict.org
_____________________________________ http://www.rapdict.org/