Caching dynamic pages and Accept-Language

Cosimo Streppone cosimo at
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, 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:

and here's a blog post about it,

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


More information about the varnish-misc mailing list