1
Configure query string caching
Drupal image styles append an
itok query parameter. The Ignore query string option controls whether query parameters are included in the CDN cache key.In the Gcore Customer Portal, open the CDN resource. Under Cache, open Query string.Leave Ignore query string disabled so each itok value stays in the cache key.On a cache miss, the CDN forwards the original query string to the origin, including itok.2
Install the CDN module
From the Drupal project root, run the command for the installed Drupal version.For Drupal 9.4 through Drupal 10, including 10.3, install CDN 4.1.0:For Drupal 11, PHP 8.3 is required for CDN 5.0.0-alpha1, because Composer rejects the package on an older PHP version:
3
Enable the configuration modules
In the Drupal administration panel, navigate to Manage > Extend. Select CDN and CDN UI, then click Install.CDN UI provides the browser-based settings and can be uninstalled after the CDN configuration is complete.
4
Open the CDN settings
Navigate to Configuration > Development > CDN, or open
/admin/config/development/cdn.5
Configure the CDN mapping
Enable the CDN module and configure a simple Origin Pull mapping. In the CDN mapping field, enter the full HTTPS custom-domain URL —
https://cdn.example.com.Use the same custom domain configured for the Gcore CDN resource. The HTTPS scheme prevents mixed-content errors when Drupal pages load over HTTPS.6
(Optional) Set file caching
On the CDN settings page, enable Forever cacheable files to generate long-lived, immutable asset URLs.For sites with many files, this option can increase origin load because Drupal may serve cache misses through PHP. Leave it disabled unless the origin can handle that behavior or the web server is configured to serve the generated paths directly.
7
Review and save the settings
Confirm that the module status is enabled and the mapping uses the HTTPS CDN domain, then click Save configuration.
8
Verify CDN delivery
Open a public Drupal page and use the browser developer tools:
- Open the Network panel.
- Reload the page.
- Filter requests for CSS, JavaScript, images, fonts, or videos.
- Confirm that public file URLs use
cdn.example.comand return successful responses. - Request an image-style URL that contains
?itok=through the CDN domain and confirm that the derivative is returned.