Re: [squid-users] Caching based on accept-language

From: Jeff Gerbracht <jeffgerbracht_at_gmail.com>
Date: Tue, 8 Feb 2011 10:30:34 -0500

Hmmm, I have Vary Accept Language added now to the response header
but I'm still getting a cache hit, even when I change browser
language. Below is still returning a cache hit of the English
version of the page, which was previously cached by Squid.

Response Headers
Date Tue, 08 Feb 2011 15:26:23 GMT
Server Apache-Coyote/1.1
Cache-Control no-cache
Expires 0
Pragma no-cache
Content-Type text/html
Age 25
X-Cache HIT from crane.ornith.cornell.edu
Via 1.0 crane.ornith.cornell.edu (squid/3.1.10)
Warning 110 squid/3.1.10 "Response is stale"
Vary Accept-Language
Connection close
Transfer-Encoding chunked

Request Headers
Host gbbc.birdsource.org
User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13 (.NET CLR 3.5.30729)
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language fr-ca,en-us;q=0.8,es-mx;q=0.6,en;q=0.4,es;q=0.2

On Mon, Feb 7, 2011 at 11:42 PM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> On 08/02/11 15:12, Jeff Gerbracht wrote:
>>
>> I'm trying to set up squid to cache several of our dynamic pages for
>> which we have both EN and FR translations.  We use the browser setting
>> for language to determine which language to return to the user so the
>> URL is the same for both languages.  Is there any way to enable Squid
>> 3.1 to use the URL in combination with the accept-language from the
>> header to generate the cache key.  Currently, whichever language is
>> first requested is what is returned by a cache hit.  We have apache in
>> front of squid so if squid can't do what we need, any suggestions on
>> how to work with apache and squid  in combination to cache both the
>> english and french versions of a page.
>
> Squid does not (yet) support that find-grained level of smart variant
> handling. It will happily cache variants on the full-text of the named
> headers though.
>
> What you need to do is specify the language variance in the same way you
> specify compressed/non-compressed variance.
>
> Sent from the web server:
>  Vary: Accept-Language
>
> (it may need combining with the existing Vary header values, probably to
> "Vary: Accept-Language, Accept-Encoding")
>
> With a ETag header as well wherever possible.
>
> Amos
> --
> Please be using
>  Current Stable Squid 2.7.STABLE9 or 3.1.10
>  Beta testers wanted for 3.2.0.4
>

-- 
Jeff Gerbracht
Lead Application Developer
Neotropical Birds, Breeding Bird Atlas, eBird
Cornell Lab of Ornithology
607-254-2117
Received on Tue Feb 08 2011 - 15:30:41 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 08 2011 - 12:00:01 MST