Multi country cache problem

Maikel Brouwer - mbrouwer at
Thu Oct 20 23:39:31 CEST 2011

On Wed, 2011-10-19 at 19:39 +0200, Hauke Lampe wrote:
> On 19.10.2011 17:29, Maikel Brouwer - wrote:
> > if ($country == 'be') {
> >   //display stuff
> > } else {
> >   //display other stuff)
> > }
> > 
> > The problem is that when someone from 'be' visits the page when it's not
> > yet cached the code in the 'be' block will be cached. When someone from
> > 'nl' visits the page it will see the 'be' block.
> I'd probably resolve the GeoIP country in VCL and set an HTTP header:
> | set req.http.X-Country-Code = geoip.client_country_code();
> The webserver then would have to add a "Vary: X-Country-Code" header to
> country-specific pages. E.g. in apache:
> | Header merge Vary X-Country-Code
> varnish would cache one copy of each object for every country code, so
> you might want to reduce the additional header to "be-or-not-be".
> A better option could be to use ESI and cache the HTML code for pages
> and ads separately. I haven't tested ESI with varnish yet, so I cannot
> give an example here.
> Hauke.

Thanks for the advice. 

But, when I'm using the geoip plugin from varnish it gives me the
following error:


Starting HTTP accelerator: varnishd failed!
Message from C-compiler:
./vcl.giASc5vH.c: In function ‘VGC_function_vcl_hash’:
./vcl.giASc5vH.c:569: warning: implicit declaration of function
Message from dlopen:
Compiled VCL program failed to load:
  ./ undefined symbol: VRT_l_req_hash
Running dlopen failed, exit 1

VCL compilation failed

Maybe it is not working anymore in v3? I'm using the example VCL that
was provided and installed Maxmind GeoIP C API without problems.



More information about the varnish-misc mailing list