The CDN module for Drupal alters URLs so static content loads from CDN servers instead of the origin server. After completing this tutorial, static content will be delivered from StackPath CDN.
This article will walk you through how to perform a static assets integration, which does not support the use of the StackPath Web Application Firewall (WAF). If you’re looking to maximize security by using our CDN with the WAF, please refer to the CDN & WAF integration guide.
This tutorial assumes a StackPath Site is created.
Configuration
The CDN module for Drupal provides two modes: Origin Pull and File Conveyor. For setting up Drupal to use the StackPath CDN, use Origin Pull. This mode is used as a domain name rewriting tool.
-
Log in to the Drupal admin panel. Select Modules, then select Install New Module.
-
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, then click Install.
-
Select Configuration, then scroll down and select CDN. In the General tab, tick the Enabled radio box, then click Save Configuration.
-
Select Details, then select Origin Pull. For the CDN Mapping box, enter your Edge Address in the following format: http://something.stackpathcdn.com
-
Replace this example URL with the Edge Address for your site.
-
Click Save Configuration.
The StackPath CDN should be properly integrated into Drupal. To test, view the source code of any page to confirm that your Edge Address is being used to deliver static assets. For example, for a given image, instead of seeing yourdomain.com/images/photo-270/ you should see http://something.stackpathcdn.com/photo-270/.
If the CDN domain is not present, follow the steps below. In some cases, changing default Drupal functions is needed.
Further Configuration
-
Navigate to Admin → Settings → Performance.
-
Enable Normal Caching.
-
Disable Page compression, Block cache, Optimize CSS files and Optimize JavaScript files, then select Clear cached data.
-
Navigate to Admin → Settings → Advagg → Config.
-
Disable Enable Advanced Aggregation, Use AdvAgg enclosure and Gzip CSS/JS files, then select Flush AdvAgg Cache.
-
Navigate to Admin → Settings → Advagg → Bundler.
-
Disable Bundler is Active.
-
Navigate to Admin → Settings → Advagg → CSS-Compress
-
Disable Compress CSS Files and Compress Inline CSS.
-
Navigate to Admin → Settings → Advagg → Js-compress
-
Disable Compress JS Files, Compress Inline JS and Enable Packer