Drupal full page caching module

3 min read

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 assists 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.

Enterprise-Grade Security and Performance

Peakhour offers enterprise-grade security to shield your applications from DDoS attacks, bots, and online fraud, while our global CDN ensures optimal performance.

Contact Us

Related Content

What are Cache Tags?

Back to learning

Cache tags are metadata that get associated with a cached object which enables very targeted flushing of content. The tags are generally returned in a custom HTTP Header, which a CDN is configured to read, so the information can be stored alongside the page/resource.

Modern CMSs …

Enterprise-Level Caching for All

Enterprise-Level Caching for All

Elevate your e-commerce with our newly released Magento 2 plugin. Experience enterprise-level caching features accessible to all Peakhour customers.

Vary Cache on Cookie Value

Vary Cache on Cookie Value

Varying the cache on a specific cookie value is a powerful way to cache personalised content. Many CDNs consider this an enterprise feature, but it's essential for modern dynamic websites.

© PEAKHOUR.IO PTY LTD 2025   ABN 76 619 930 826    All rights reserved.