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

From: Chris Robertson <crobertson_at_gci.net>
Date: Thu, 05 Jun 2008 12:45:28 -0800

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 Thu Jun 05 2008 - 20:45:48 MDT

This archive was generated by hypermail 2.2.0 : Fri Jun 06 2008 - 12:00:03 MDT