Using WP Rocket with a CDN
CDN Compatibility: WP Rocket has its own premium CDN service, RocketCDN, and is generally compatible with most CDN providers, including Amazon Cloudfront, MaxCDN, KeyCDN and others. Depending on your needs, you can of course use a CDN in addition to Cloudflare. If you need information about Cloudflare, it's here:
Using WP Rocket with Cloudflare
In this article
RocketCDN is a premium, optimized CDN service with easy integration from the WP Rocket CDN tab:
Default: “Pull” CDN
A “pull” CDN (or “pull zone”) will automatically import (“pull”) files from your WordPress site. To use WP Rocket with a “pull” CDN, activate the Enable Content Delivery option, copy the CNAME (domain) given to you by your CDN provider and enter it in CDN CNAME field into the CDN tab of WP Rocket settings:
WP Rocket's CDN feature will:
- Rewrite all URLs for your assets (static files like images, CSS/JS files) that are present in the HTML of the page.
- Add a
preconnectresource hint for your CDN CNAME, with a
dns-prefetchas a fallback.
Heads up! If you see that a file is not being served from your CDN, it might be because it's being loaded from an AJAX request, or being dynamically inserted into the page after the HTML has already been generated.
Advanced: “Push” CDN
A “push” CDN (or “push zone”) does not import any files from your website by itself; instead your website must send (“push”) all required files to the CDN.
WP Rocket does not handle the push process itself. If you use a "push" CDN, you will need an extra plugin to send your assets.
If you use Amazon Cloudfront as a “push” CDN, we recommend this plugin (plus the add-on for the other static files) to get your assets uploaded to Cloudfront automatically:
Further reading on Cloudfront:
- What is Amazon Cloudfront? Developer Guide
- How to use Amazon Cloudfront to speed up your WordPress site
MaxCDN provide these resources for WordPress site administrators:
KeyCDN have a tutorial for setting up WP Rocket with their service here:
If your site is hosted at Kinsta and you are using their CDN service, you still have to enable the CDN option in WP Rocket, and enter your CDN URL so our plugin can detect it and function correctly.
You can find your unique Kinsta CDN domain from the CDN tab in your Kinsta account.
If your site is hosted at WP Engine and you have enabled the CDN option there, you still have to enable the CDN option in WP Rocket, and enter your CDN URL so the plugin can detect it and function correctly.
If you're not sure what your CDN URL is, you can find it by following the instructions in WP Engine's doc.
If your site is using Optimole for image optimization and delivery using their free CDN, you don't need to enable the CDN option in WP Rocket and add CDN CNAME.
If your site is hosted at GoDaddy Managed WP and you are using their CDN service, you still have to enable the CDN option in WP Rocket, and enter your CDN URL in our CNAME field (e.g.
https://secureservercdn.net/184.108.40.206/wmr.xxx.myftpupload.com/) so our plugin can detect it and function correctly. If you’re not sure what your CNAME is, please contact your GoDaddy support.
CDN on SSL sites
If your site is SSL-enabled, i.e. it uses HTTPS, your CDN must also serve files via HTTPS. To check if your CDN is SSL-enabled, visit the HTTPS version of your CDN URL in your browser. If it is NOT SSL-enabled, you will see a security warning like the one below:
You have to contact your CDN provider to enable HTTPS for your account.
If you experience any other issues with your CDN setup in WP Rocket, please review these articles from this documentation:
Please note: If you're using a custom media uploads directory, the wp_uploads_dir function is used to determine the correct path.