Caching dynamic pages and Accept-Language

Cosimo Streppone cosimo at streppone.it
Sat Jan 23 15:40:24 CET 2010


Hi everyone,

we're trying to cache our first full HTML page with Varnish
after some static content experience.

One of the things we're confronting with is the "Accept-Language" header.
This is for my.opera.com, where we have 18 different languages.
Since Accept-Language is very variable, we thought of normalizing it.

Asking in #varnish, Poul suggested using regsub. We're already doing that
for User-Agent, but accept language parsing is messier, so
I tried the embedded C code alternative.

I think the result might be useful for others. Kristian also gave me
some tips to make it saner, so it became a completely
generic accept-language.vcl. Here's the code:

   http://github.com/cosimo/varnish-accept-language/

and here's a blog post about it,

   http://my.opera.com/cstrep/blog/2010/01/23/my-opera-front-page-caching-and-varnish-hacking

I'd be glad to read your feedback on this.
Thanks,

-- 
Cosimo



More information about the varnish-misc mailing list