Using WP Rocket with a CDN
CDN Compatibility: WP Rocket is generally compatible with most CDN providers, including Amazon Cloudfront, MaxCDN, KeyCDN and others. If you need information about CloudFlare, it's here : using WP Rocket with CloudFlare
In this article
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, all you have to do is copy the CNAME (domain) given to you by your CDN provider and enter it into the CDN tab of WP Rocket settings:
WP Rocket will rewrite all URLs for your assets (static files) that are added using WordPress functions, for example post thumbnails, stylesheets and the like.
Heads up! In case you see that an image is not being served from your CDN, it might be because your theme, or a plugin does not use a WordPress function to retrieve said image. In that case you can use a PHP function to add the image to your CDN.
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 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:
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 can contact your CDN provider to enable HTTPS for your account, otherwise you can use the WP Rocket option to disable the CDN on HTTPS pages:
If you experience any other issues with your CDN setup in WP Rocket, please review these articles from this documentation: