Find answers, guides, and tutorials to supercharge your content delivery.

Drupal CDN Integration

Updated on October 4, 2018

Drupal is a free, open source CMS based on PHP. About 2.1% of the websites globally are powered by Drupal. Like other content management systems, it offers a wide range of modules that can be integrated into Drupal websites.

Slow Drupal website? KeyCDN can change that. Here’s why: KeyCDN will cache the static files of a Drupal website all around the world. In addition to optimizing a Drupal website, it’s essential to integrate a CDN for better performance. KeyCDN will cache the assets as long as specified in the HTTP headers defined by the origin server.

How does the Drupal CDN module work? The module will change the URL of static assets. The new URL will point to KeyCDN instead of the origin server. There is no redirection taking place, the URL will be rewritten to the KeyCDN domain. An example would be:

  • URL to the origin server: https://www.yourwebsite/drupalfolder/pic.jpg
  • New URL to KeyCDN:

Let’s get started with the Drupal CDN Integration

This tutorial shows how to complete a Drupal CDN integration with KeyCDN.

  1. Create a Pull Zone before you start with the Drupal CDN integration. A Push Zone would work as well but it’s not recommended here.
  2. Click on the menu item “Modules”, then click “Install New Module”.
  3. Go to Extend > Install new module > Install from a URL, enter the CDN Module URL: (check the official Drupal CDN module for the lastest version) and click “Install”.
  4. Go to the Extend page and under Web Services select both “CDN” and “CDN UI” then click Install.
  5. Navigate to Configure > Web Services > CDN Integration. Set the CDN status to enabled and enter your CDN URL that you get from the KeyCDN dashboard (e.g. You can also use your Zone Alias (e.g. Save the changes.
    The setting “Far Future expiration” will define higher caching values for the assets (valid for KeyCDN, as well as the client’s browser). Longer cached assets will result in less request to the CDN and the origin server, this can further improve the loading time. Alternatively, if you want to define higher caching values for assets, we recommend to do so in the KeyCDN dashboard for this specific Zone. Please note that content cached by KeyCDN can be purged anytime, but content cached by a browser cannot be purged.
  6. A red warning box appears. Click on “Aggregate and compress CSS files”. Within the Bandwidth Optimization box, check Aggregate and compress CSS files and Aggregate JavaScript files, then save the configuration.
  7. We always recommend checking the changes in the HTML code. Make sure the URLs have been rewritten properly.

That’s it. The Drupal CDN integration is completed. If there are any issues after the CDN integration, the KeyCDN support can be contacted anytime.

Drupal cache tags

Cache tag support was introduced with Drupal 8. Cache tags offer a convenient way to purge assets (also known as tag-based invalidation). It’s an alternative to purging by URL. The advantage of purging by tags is that several assets can have the same tag (vs. one asset can only have one URL).

The Drupal cache tags need to be added on the origin server. The Cache-Tag is a regular HTTP header returned by the origin server. It’s possible to add several tags separated by spaces as shown in the example below. KeyCDN POPs preserve the tags, which means the tags are also visible to end clients.

Cache-Tag: tag1 tag2 tag3

Once the cache tags are in place, it’s very easy to purge them. Execute the following steps:

  1. Log in to the KeyCDN dashboard.
  2. In the left navigation sidebar click Zones.
  3. In the Zones table click the Zone menu that you want to purge. From the drop down click Purge by Tag.
  4. Enter one or more tags separated by a space (e.g. tag1 tag2 tag3).
  5. Click Purge.

In addition to purging tags via the dashboard, it can be purge the same way through the API.

The benefits of using KeyCDN with Drupal

Once KeyCDN is integrated into a Drupal site, there are lots of advantages to benefit from:

  • Access to our complete network of POPs. Content is always served from the closest location to the end users.
  • Real-time statistics can be monitored in the KeyCDN dashboard.
  • KeyCDN supports HTTP/2 for even faster content delivery. There’s no special configuration needed to take advantage of the new protocol.

KeyCDN also offers great tools and an up to date knowledge base. Here some useful pages:

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more about cookies.