We have a Drupal 7 site whose content is split into geographic regions. The concept is that page view blocks and filters will display region specific content based on the users IP address or selection of their country, the page URL is the same throughout. The issue we now have is that Drupal cache and Varnish cache are not regionally aware in that the cache is built up by the first visit upon start and clearing of cache so the wrong content gets displayed to a user who wishes to view content for his region, because someone before him opened the same page from another region. Any ideas?

1 Answer 1


Possible solution of separating your caches, by regions, in Varnish is to use GeoIP VMOD: https://github.com/lampeh/libvmod-geoip

Simple example:

put country code to hash

sub vcl_hash {

        if (req.http.host) {
        else {

        # separate caches by countries

        return (hash);

Now caches for different countries will be different. Of course, you still need to take care about page generation in Drupal, it should provide different content for different regions too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.