Important note

This tutorial assumes you have already created a Pull Zone.

The CDN module add-on for Drupal will alter URLs, so your static content will load from the CDN servers, as opposed to your origin server. The module provides two modes: “Origin Pull” and “File Conveyor”. For setting up the site to use our CDN you need to only use “Origin Pull,” which is basically used as a domain name rewriting mode.

Installing Drupal CDN

  1. Login to your Drupal admin panel, click “Modules”, then click “Install New Module”.
  2. In the “Install from a URL” box, enter the CDN Module URL: http://ftp.drupal.org/files/projects/cdn-7.x-2.6.zip (check the official Drupal CDN Project Page for the newest stable version), and click “Install”.
  3. Now click on “Configuration”, then scroll down to click on “CDN”. In the “General” tab, tick the “Enabled” Radio Box then click “Save Configuration.”
  4. Click on “Details” then select “Origin Pull”. For the “CDN Mapping” box, enter the CDN URL in the following format: http://foo.bar.netdna-cdn.com
    (please note that the URL should be replaced with the original CDN URL you have).
  5. Click “Save Configuration”.

Your website should now be using CDN services, and you can confirm this by reloading your website and viewing the page source. If your Origin URL is rewritten to the CDN temporary URL you are all set.

Important note

In some cases you will have to tweak some default Drupal functions in order to properly implement the CDN:

  1. Navigate to admin → settings → performance
  2. Enable normal caching.
  3. Disable “Page compression”, “Block cache”, “Optimize CSS files” and “Optimize JavaScript files” then click “Clear cached data.”
  4. Navigate to admin → settings → advagg → config
  5. Disable “Enable Advanced Aggregation”, “Use AdvAgg in closure” and “Gzip CSS/JS files” then click “Flush AdvAgg Cache.”
  6. Navigate to admin → settings → advagg → bundler
  7. Disable “Bundler is Active.”
  8. Navigate to admin → settings → advagg → css-compress
  9. Disable “Compress CSS Files” and “Compress Inline CSS.”
  10. Navigate to admin → settings → advagg → js-compress
  11. disable “Compress JS Files”, “Compress Inline JS” and “Enable Packer.”

NOTE

To ensure you implemented MaxCDN correctly, you can view the source code of any page to confirm that the CDN domain is being used for static assets instead of your origin domain. You can also use tools like pingdom, gtmetrix, webpagetest that can give you more detailed reports on your CDN implementation status.