Multi-language (cookie) site configuration

Hugo Cisneiros (Eitch) hugo.cisneiros at gmail.com
Tue Jun 12 00:03:09 CEST 2012


On Wed, May 23, 2012 at 6:41 AM,  <silentneedle at safe-mail.net> wrote:
> I'm trying to setup varnish for a multi-language vbulletin forum. The language is set through a cookie (bblanguageid).
>
> My current configuration is: http://pastebin.com/wCKZUcTX

By the way, I don't think you can redefine VCL functions multiple
times as you do in this configuration. It will consider only the first
definition.

> Now I've tried to cache a separate version if the bblanguageid=2 cookie is present:
>
> sub vcl_hash {
>     if (req.http.cookie ~ "bblanguageid=2") {
>            set req.hash += "deDE";
>     }
> }

I do this very frequently (but with Varnish 3.0.2). The idea is the
same, but I use hash_data to add the custom string "deDE". Here, the
only thing you really need is this configuration. With this, varnish
must be generating a different cache entry for this request with the
cookie.

To know exactly what is happening, you must use 'varnishlog' command
and look at what varnish is doing, if it's adding the custom hash, and
so on.

-- 
[]'s
Hugo
www.devin.com.br



More information about the varnish-misc mailing list