Cookie inspection

Omar Kilani omar.kilani at
Tue May 29 13:01:12 CEST 2007

On 5/29/07, Poul-Henning Kamp <phk at> wrote:
> In message <f0cc3e3e0705282205h3b43065atbc1ee434a6adec94 at>, "Omar
>  Kilani" writes:
> >Doing something like req.http.Cookie.LANGUAGE *could* theoretically do
> >the right thing (and use http_GetHdrField, although some browsers can
> >send multiple values for the same cookie name... :) and *looks* right,
> >but obviously has a very different meaning in VCL where it compiles
> >to:
> The Planned syntax is:
>         req.http.Cookie[language]
> and just as for http headers, the headers will be read sequentially
> and the last found value is used.

That makes a lot more sense. :)

Out of curiosity, are things like this documented on Trac or somewhere else?

I probably missed it searching the tickets - has this work been started?

> >
> Not bad :-)

Hehe - I really just meant to illustrate what I was getting at with
the patch. ;)

It took longer to write the email than to code up the patch, which I
think says a lot about the hackability of the code and how easy it is
to understand.

> >The other thing I'd like to be able to do is have some sort of 'first
> >match over an array of header values' VCL construct, so you could vary
> >the hash by whatever languages in Accept-Language your site supports
> Does your backend include a proper Vary: header when it selects on
> language ?

Yes, but I'm not sure how Vary on Accept-Language is supposed to work
- does it just add the entire value to the hash key or?

Wouldn't the hit rate be low on the cached content if this was the case?

For example, I'd serve en-US to all these browsers (whose language
settings I haven't changed):

Opera (which sends the following Accept-Language value):






But would they all be cached independently and served different
versions of the same document?



More information about the varnish-misc mailing list