Andrew Pounce wrote:
Chris Robertson wrote:
Andrew Pounce wrote:
Hi,

 I have a website which uses squid as an accelerator that serves content
as a series of numbers such as  /12345/12345/12345/12345 which can be
images, html or pretty much anything else.

 Some of the html varies depending on status of the user session ( are
they authenticated etc )
If the user is authenticated, the server is likely sending out a
"Cache-Control: private" header.

The authentication is handled by the app rather than standard http-auth
which is one of the reason's that I'm attempting to cache particular
parts of the site rather than all of it which would be much easier.

 I want to :-

 Cache ALL images.
 not cache ALL html.

 now I my understanding of things I can check the mime type with acl's
and cache allow/cache deny :-

acl imagesmime rep_mime_type image/jpeg
acl imagesmime1 rep_mime_type -i image/jpeg
cache allow imagesmime
cache allow imagesmime1
cache deny all

I keep seeing TCP_MISS's for images dispite this, the mime type
image/jpeg ( according to the access.log ) so I don't understand whats
going on - am I missing something obvious?

Having used the firefox live headers tool I see pretty much what the
squid logs were telling me :-
http://www.xxxxx.xxx:8080/1242167/2184304

GET /1242167/2184304 HTTP/1.1
Host: www.xxxxx.xxx:8080
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1)
Gecko/20060601 Firefox/2.0.0.1 (Ubuntu-edgy)
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Cookie: balancer=TC1; JSESSIONID=blah

HTTP/1.x 200 OK
Cache-Control: s-maxage=8477, max-age=0

I'm not an expert, but I think this would be your problem. From http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html:

When the max-age cache-control directive is present in a cached response, the response is stale if its current age is greater than the age value given (in seconds) at the time of a new request for that resource.
and

If a response includes both an Expires header and a max-age directive, the max-age directive overrides the Expires header, even if the Expires header is more restrictive.

s-maxage is a HTTP 1.1 construct (if I'm not mistaken), and Squid is not 1.1 compliant. So you are saying this content is always stale.

Etag: 1.4
Expires: Mon, 29 Jan 2007 12:48:45 GMT
Last-Modified: Fri, 11 Aug 2006 12:48:45 GMT
Content-Type: image/jpeg
Content-Length: 25586
Date: Mon, 29 Jan 2007 10:27:27 GMT
Server: Apache-Coyote/1.1
X-Cache: MISS from proxya
X-Cache-Lookup: MISS from proxya:3128
Via: 1.0 proxya:3128 (squid/2.6.STABLE1)
Proxy-Connection: keep-alive
----------------------------------------------------------

 I don't get this as I thought that the rep_mime_type should catch this..

Thanks,

 -Andrew


Chris

Reply via email to