varnish & cookies & multilanguage
Poul-Henning Kamp
phk at phk.freebsd.dk
Thu Aug 2 11:32:14 CEST 2007
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.
More information about the varnish-misc
mailing list