Using WP Rocket With A CDN
WP Rocket is compatible with many CDN providers including MaxCDN, Amazon Cloudfront, and others.
In this article
Using a “Pull” CDN
To use WP Rocket with a “pull” CDN, all you have to do is enter the CNAME given to you by your CDN provider into the CDN tab of WP Rocket settings:
WP Rocket will then rewrite all URLs for your assets that are added using WordPress functions (e.g. post thumbnails). If you see that an image is not being served from your CDN, it might be because your theme, or a plugin is does not use a WordPress function to retrieve said image. In this case you can use this PHP function to add the image to your CDN.
Using a “Push” CDN
If you use a "push" CDN, then you also need to make sure that your images and other assets are being sent to your CDN. You will need an extra plugin to push your assets—WP Rocket does not take care of that action.
For example if you use Amazon Cloudfront as a “push” CDN, you will also need to use this plugin:
WP Offload S3 Lite
If your site is SSL-enabled,i.e. it uses HTTPS, that means your CDN must also serve files via HTTPS, otherwise your site will have issues. 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'll 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 want to learn more about Amazon Cloudfront and how to set it up correctly, we recommend these articles:
- What is Amazon Cloudfront? Developer Guide
- How to use Amazon Cloudfront to speed up your WordPress site
If you use MaxCDN instead, you can find useful setting information here:
KeyCDN have a tutorial for setting up WP Rocket with their service here:
If you experience any issues, please review these docs: