Re: [squid-users] Quick question about squid serving images

From: Angelo Höngens <a.hongens_at_netmatch.nl>
Date: Thu, 19 Nov 2009 09:56:25 +0100

On 19-11-2009 9:46, NublaII Lists wrote:
> I have squid configured (working on it ;)) as a reverse proxy.
>
> My understanding (and I can be wrong) is that once I request an image,
> next requests for that image will not reach the web server in any way
> until it expires, either manually or reaches end of life... is that
> correct?

If you would have configured everything correctly, yes..

> I am asking because I can see on my apache logs a ton of hits on
> images that squid should be caching, and still arrive to the www
> server, so either I don't have it configured properly or I don't
> really understand how squid works on reverse proxy mode ;)

It should work like you say, but either squid is not configured
correctly, or the application tells squid not to cache. Squid decides
what it can cache, based on the response headers from the apache
application. Post those headers. The squidclient tool is really useful.

Run this on your squid machine (example, assuming your squid listens on
port 80):

squidclient -p 80 -h apacheserver http://domain/image.jpg | head -n 15

Increase or decrease the 'head -n X' value to show all the headers, but
not to return the binary content. It should return something like this:

HTTP/1.1 200 OK
Cache-Control: public
Content-Type: image/jpeg
Expires: Thu, 19 Nov 2009 09:08:51 GMT
Last-Modified: Thu, 19 Nov 2009 04:51:23 GMT
Server: Microsoft-IIS/7.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
Date: Thu, 19 Nov 2009 08:54:51 GMT
Connection: close
Content-Length: 2845

Based on these response headers, Squid decides to cache or not.
Particularly interesting is the 'Cache-Control' header. From there on,
google further ;)

-- 
With kind regards,
Angelo Höngens
systems administrator
MCSE on Windows 2003
MCSE on Windows 2000
MS Small Business Specialist
------------------------------------------
NetMatch
tourism internet software solutions
Ringbaan Oost 2b
5013 CA Tilburg
+31 (0)13 5811088
+31 (0)13 5821239
A.Hongens_at_netmatch.nl
www.netmatch.nl
------------------------------------------
Received on Thu Nov 19 2009 - 08:56:43 MST

This archive was generated by hypermail 2.2.0 : Fri Nov 20 2009 - 12:00:04 MST