[squid-users] bypassing cache under certain circumstances

From: Aurimas Mikalauskas <aurimas.mikalauskas@dont-contact.us>
Date: Sat, 8 Mar 2008 20:47:17 +0000

Hello,

For the setup I'm about to discuss, I used to use varnish, but due to
stability issues decided to use squid instead. It's a rather usual
reverse-proxy setup with squid 3.0. However, I do have one issue that
could have been solved easily with varnish, but I can't find a good
solution for squid. Thing is:

Pages are cached. I want them to be cached, but.. there are some users
that come with a Cookie NOCACHE. I want those users to get fresh
pages, but at the same time, I want that other users would gather the
cached pages as usually. I tried the following:

acl nocache_cookie req_header Cookie NOCACHE
cache deny nocache_cookie

However, as described in
http://www.squid-cache.org/Versions/v3/3.0/cfgman/cache.html - "use
this to force certain objects to never be cached" and not only it does
not cache then - but also updates it's cache lists that the object is
not cached. So what I get is:

#1 user comes w/o NOCACHE -- she gets a CACHE_MISS, page from
originserver, and gets it cached
#2 user comes w/o NOCACHE -- she gets a CACHE_HIT i.e. the cached page
#3 user comes w/ NOCACHE -- she gets a CACHE_MISS and fresh page
directly from originserver (page does not get cached)
#4 user comes w/o NOCACHE -- she gets a CACHE_MISS, page from
originserver, and gets it cached

and obviously this is not what I want - I'd rather have page kept in
cache at step #3 (at the same time feeding the page directly from
originserver to user #3).

In varnish I could have achieved that with

sub vcl_recv {
        if (req.http.Cookie ~ "NOCACHE") {
                pass;
        }
}

Appreciate your thoughts!

// Aurimas
Received on Sat Mar 08 2008 - 13:47:27 MST

This archive was generated by hypermail pre-2.1.9 : Tue Apr 01 2008 - 13:00:05 MDT