RE: [squid-users] How to not cache a site?

From: Jerome Yanga <jyanga_at_esri.com>
Date: Thu, 5 Jun 2008 17:22:30 -0700

Thanks for the quick response, Chris.

Here are my attempts to answer your questions. :)


Using Live HTTP Headers plugin for Firefox. It seems to show that Cache-Control and Pragma settings.

http://site_address.com/help/jssamples_start.htm

GET /help/jssamples_start.htm HTTP/1.1
Host: site_address.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
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
Connection: keep-alive
Cookie: CFID=1234567890; CFTOKEN=1234567890; SESSIONID=1234567890; __utma=11111111.111111111.111111111.111111111.111111111.3; __utmc=111111111; __utmz=111111111.111111111.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmb=111111111.4.10. 111111111

HTTP/1.x 200 OK
Date: Thu, 05 Jun 2008 23:41:00 GMT
Server: Apache
Last-Modified: Thu, 05 Jun 2008 09:03:27 GMT
Etag: "111111111-111111111-111111111"
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Cache-Control: no-store, no-cache, must-revalidate, max-age=0
Expires: Thu, 05 Jun 2008 23:41:00 GMT
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Pragma: no-cache
Content-Length: 811
Connection: keep-alive


I purge the cache using a purge command.

#file /cache/usr/bin/purge
/cache/usr/bin/purge: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped

...and the syntax I use is below.

#/cache/usr/bin/purge -n -v -c /etc/squid/cachepurge.conf -p 127.0.0.1:80 -P 1 -e site_address\.com > /var/log/site_address.com_purge.log

I grep'ed the log created from the command above and I can find instances of site_address.com being deleted. Hence, it is being cached.

I have also reviewed the access.log and I found a some TCP_MEM_HIT:NONE, TCP_REFRESH_HIT, TCP_IMS_HIT, TCP_HIT, TCP_REFRESH_MISS.

I cannot review the store.log as it is disabled.

I shall try the syntax you have provided on the next available downtime.

acl cacheDenyAclName dstdomain .site_address.com
acl otherCacheDenyAclName urlpath_regex ^/help/
cache deny cacheDenyAclName otherCacheDenyAclName

Thanks again, Chris.

Regards,
Jerome


-----Original Message-----
From: crobertson_at_gci.net [mailto:crobertson_at_gci.net]
Sent: Thursday, June 05, 2008 1:45 PM
To: squid-users_at_squid-cache.org
Subject: Re: [squid-users] How to not cache a site?

Jerome Yanga wrote:
> I have the following in my site_address.conf file.
>
> ExpiresDefault A0
> Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
> Header set Pragma "no-cache"
>

If these headers are indeed being set, Squid will not cache this content
(without some effort). Have you verified that these headers are being
sent out? If your site is internet accessible, you can use a hosted
version of the cacheability engine (such as
http://www.ircache.net/cgi-bin/cacheability.py), or you can download and
set up a locally hosted version
(http://www.mnot.net/cacheability/download.html), or you can look into
the Live HTTP Headers plugin for Firefox
(http://livehttpheaders.mozdev.org/).

> However, this does not seem to work as whenever I perform a purge of the cache, I still see stuff being deleted.

How (and why) are you purging the cache? Are you sure the objects you
are purging are ones that you have specified not be cached? Have you
checked your access.log to see if the requested objects are being served
from cache, or the store.log to see if the objects are being cached at all?

> I have been searching the web and I found the no_cache directive.

The no_cache directive was deprecated with the release of Squid 2.6. It
has been renamed "cache" in currently supported versions of Squid.

> I also found out that this directive is added into the squid.conf. I cannot seem to find proper syntax definition for this directive. I can only find examples which may not work for me. Hence, I am posting a message for the first time. Yes. I am a noob. Please be nice to me. ☺
>
> Nevertheless, given the following information, how do I use this directive?
>
> Site: www.site_address.com
>

Assuming you want to go this route (which will only affect your cache,
and not ISP caches, or browser caches) to deny caching of the whole site
you'd use something like...

acl cacheDenyAclName dstdomain .site_address.com


Note the leading dot on the domain name. That will match the domain and
all subdomains.

>
> If I wanted to just make not cache a folder in this site, how would the syntax look?
>
> Site & Folder: www.site_address.com/help/
>

acl cacheDenyAclName dstdomain .site_address.com
acl otherCacheDenyAclName urlpath_regex ^/help/
cache deny cacheDenyAclName otherCacheDenyAclName

Here, I am using a combination of ACLs to reduce the load of using
regular expressions. If the host matches, then (and only then) the path
is checked. If both match, caching is denied. The following
(non-exhaustive) list of URLs would be excluded from caching with this
set up...

www.site_address.com/help/index.html
site_address.com/help/image.gif
webmail.site_address.com/help/me/figure/this/out.php

> Please provide a syntax for each question.
>
> By the way, if I am going about “no cache” the wrong way, please also indicate. ☺
>

Indicated. Make sure your server is sending out the headers you think
it is.

> Thank you in advance.
>
> Regards,
> Jyanga
>

Chris

Received on Fri Jun 06 2008 - 00:22:37 MDT

This archive was generated by hypermail 2.2.0 : Sat Jun 07 2008 - 12:00:03 MDT