Re: [squid-users] Caching pages for users without a cookie (guest)

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 15 Jan 2009 09:02:59 +1300 (NZDT)

> The thing is that squid should cache for some users and not for other
> users.
>
> Lets say we have two users, me (logged in) and guest (not logged in).
>
> Both ask for the same page with this sequence:
> 1. guest
> 2. me
> 3. guest
>
> Then we want:
> 1. guest: get page from origin and cache the response (cache miss).
> 2. me: get page from origin again, do not cache the response (cache
> bypassed).
> 3. guest: get page from cache, do not go to origin server (cache hit).
>
> Response 1 has Expires and max-age headers, but squid should NOT honor
> them in request 2 and should honor them in request 3. This decision is
> based on the cookie. So the cookie acl will override the expected HTTP
> based behaviour.
>
> I think a regular expression on the cookie can determine if squid should
> go to the origin server (regardless of what is in the cache) or act as
> normal (cache based on HTTP headers). This is done per request. The
> response headers can be used only in request 3, but they should be ignored
> in request 2.

You mentioned Expires and Cache-Control, earlier. I just had a thought
that Vary: and ETag: headers may need to be set for these pages.

Squid will cache (1) then if (2) looks identical but has auth headers it
will purge the cached copy (page has apparently become private/authed) and
have to fetch a new one for (3).
With Vary: something (I'm not sure if Cookie: or *-Auth* values are best)
Squid may be expected to cache the copies differently.

To test whether this is right try this sequence:
  (1), (guest), (2), (3), (guest)

If it is a vary issues I would expect the marked (guest) to be HIT but (3)
to be MISS despite the earlier (1).

Amos

>
> Thanks
>
> Elli
>
> ----- Original Message -----
> From: Amos Jeffries <squid3_at_treenet.co.nz>
> To: Elli Albek <elli_at_sustainlane.com>
> Cc: squid-users_at_squid-cache.org
> Sent: Wed, 14 Jan 2009 01:06:40 -0800 (PST)
> Subject: Re: [squid-users] Caching pages for users without a cookie
> (guest)
>
> Elli Albek wrote:
>> Hi,
>> Those are dynamic pages, but their URLs to not contain any query
>> parameters.
>> The home page is a good example for a URL that is database driven.
>>
>> In addition URLs like those:
>>
>> mydomain.com/san-francisco
>> mydomain.com/los-angeles
>> mydomain.com/whats-hot
>>
>> Etc. Those are all dynamic pages with file URLs.
>
> Then you have a bug somewhere. Squid should be caching according to your
> control headers.
>
> Amos
>
>
>
Received on Wed Jan 14 2009 - 20:03:09 MST

This archive was generated by hypermail 2.2.0 : Fri Jan 16 2009 - 12:00:03 MST