Drupal is an open source content management system (CMS) widely used by Australian government websites. For example, GovCMS is a customised version of Drupal! Peakhour is pleased to announce that we're enhancing our already great Drupal offering, by providing a Peakhour purge module to enable seamless integration with Drupal 8/9.

The Peakhour Purge module extends the Drupal Purge module. The Purge module provides a standardised way of seamlessly integrating third party CDNs, like Peakhour, with Drupal's native full page caching support. Drupal's native support is suitable for small websites, but has a number of drawbacks. These drawbacks include:

  • Doesn't support the Vary header.
  • Is served by PHP, so it doesn't scale well.
  • Runs on the same server as Drupal, so geographic latency is still an issue.

Peakhour's advanced, global CDN+ eliminates all of these issues, as well as adding image/content optimisation and comprehensive website security.

Default Caching

Ever since version 8, Drupal has supported cache tags to provide efficient, targeted invalidation of content for anonymous browser sessions, anonymous meaning a user that does not have a Drupal Session cookie. Peakhour has support for cache tags for all sites, a feature some competitors regard as 'Enterprise'.

Cache tags are great, but another default setting is not. That setting is to add a:

Vary: Cookie

Header to the page response to make sure that users that are logged in don't get cached pages. The Vary header informs a cache that different content may be served from origin based on the value in the Cookie header sent by the browser.

This is fine if you are using drupal with no third party javascript libraries. However, if you do use third party libraries it can render page caching close to useless. For example, drupal.org itself uses perimeterx for bot detection. This results in a unique session cookie being set on the very first request.

The cookie set by perimiterx The first request to drupal.org results in a unique cookie being set by perimiterx

If you use Google analytics, Facebook, or any of a wide array of popular third party libraries, then the same thing is going to happen!

This means only the very first request from the user could be served from a general page cache. Hit rates would be virtually zero.

Fix the Vary issue with Skip Cache on Cookie

Fortunately Peakhour gives you a way to work around this. The first step is to disable Vary: Cookie header, then to make sure any user with a Drupal Session bypasses the cache you use Peakhour's Skip Cache on Cookie feature. As soon as a session cookie is set by Drupal, eg when someone logs in, Peakhour will pass requests through to the origin. Full instructions on how to do this are provided on our drupal module documentation

eCommerce Drupal sites

If you are running an ecommerce store, or some other type of site that might serve customised information on a page, for example a mini cart with cart count/information, then you will have to do custom development to continue caching pages. A workaround for a mini cart would be to make it load via Ajax or to use local browser storage, Luckily Peakhour can assist in making that happen.

Future features

Hopefully in the future Drupal will support setting their own cookie for varying the cache, in a similar manner to Magento 2. eg X-Drupal-Vary, this would allow Peakhour to store multiple versions of a page to serve to different users. For example a user in Germany might get a version of a page in German with German Currency.


With our Peakhour Purge module we've just made our service even more compelling for Drupal users. If you're in charge of an Australian government website and are looking for a sovereign Australian solution then why not try Peakhour.

Check out our plugin page or contact us for more information!

Website Performance Drupal Plugins