varnish & cookies & multilanguage

rafailowski rafailow at gmail.com
Thu Aug 2 16:02:26 CEST 2007


2007/8/2, Poul-Henning Kamp <phk at phk.freebsd.dk>:
> In message <8e6064260708020220q2ae3fe98ia3fcb9d0a6f186b4 at mail.gmail.com>, rafailowski writes
> :
> >Hello,
> >I'm new to varnish and i have some problems with cookies.
> >I have to cache a website who use coookies to determine the language.
> >
> >The cookies are:
> >15 TxHeader     b Cookie: _ZopeId="23273311A29b-he1CIg"; LOCALIZER_LANGUAGE="es"
>
> >Is there's a way to cache a website like this, using cookies for language?
>
> I can think of one way that might work:
>
> Hash that part of the cookie in addition to the URL and host, something like:
>
>         vcl_hash {
>                 if (req.http.cookie) {
>                         set req.hash += regsub(
>                             req.http.cookie,
>                             ".*LOCALIZER_LANGUAGE=\"(..)\".*",
>                             "$1");
>                 }
>         }
>
> (If this work, please take a moment to add it to our FAQ!)
>
> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> phk at FreeBSD.ORG         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>
>         vcl_hash {
>                 if (req.http.cookie) {
>                         set req.hash += regsub(
>                             req.http.cookie,
>                             ".*LOCALIZER_LANGUAGE=\"(..)\".*",
>                             "$1");
>                 }
>         }

There's a little problem with these regexp
".*LOCALIZER_LANGUAGE=\"(..)\".*",
At the second \ ,varnish returns a "Syntax error".
I've tried different things around with regexp but i can't make it run.
What's wrong ?



More information about the varnish-misc mailing list