Re: [squid-users] Squid not caching images

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Mon, 16 Jul 2012 16:56:53 +1200

On 16/07/2012 4:36 p.m., Abhishek Chanda wrote:
> Hi all,
>
> I am running Squid 3.1.19 on Ubuntu 12.04. I have a simple html page
> with an image that is hosted on a Apache server on the same LAN. The
> server runs on 192.168.122.11, Squid on 192.168.122.22 and the client
> here is 192.168.122.33. The problem is, Squid caches the html page but
> does not cache the image in it. Access.log shows this:
> 1342409528.532 0 192.168.122.33 TCP_MEM_HIT/200
> 577 GET http://test-server/ - NONE/-
> text/html
> 1342409533.541 4960 192.168.122.33 TCP_MISS/200
> 5966089 GET http://test-server/rc.jpg - FIRST_UP_PARENT/myAccel
> image/jpeg
>
> My config is this:
<snip>
> This is the HTTP header when the web server connects to Squid, it does
> have Cache-Control with max-age set to a high value.

max-age is 10 days, seems reasonable for images.

There is also a request made into Squid by the client. That client
request has a large part in determining whether Squid cache can provide
a HIT or MISS response.

>
> HTTP/1.1 200 OK,
> Date: Mon, 16 Jul 2012 04:21:09 GMT,
> Server: Apache/2.2.22 (Ubuntu),
> Last-Modified: Fri, 13 Jul 2012 17:59:08 GMT,
> ETag: "49f46-5b0795-4c4b9d6354b1f",
> Accept-Ranges: bytes,
> Content-Length: 5965717,
> Cache-Control: max-age=864000, public
> Keep-Alive: timeout=5, max=100,
> Connection: Keep-Alive, Content-Type: image/jpeg,
>
> How can I fix this? Am I missing something here?

I assume you have replaced all the newlines with commas for some reason,
which puts some doubt ino what the end of line for Cache-Control is
since "public" is missing an end-of-line marker.

Then there is the Content-Length of nearly 6MB. Increase
maximum_object_size to something larger to store these massive images.
Squid by default has a 4MB maximum size for cached objects, which is
enough to store most images, audio, and short videos.

Amos
Received on Mon Jul 16 2012 - 04:57:08 MDT

This archive was generated by hypermail 2.2.0 : Mon Jul 16 2012 - 12:00:02 MDT