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:

Enable CDN option in 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

SSL Sites

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: 

Security Warning on non-SSL CDN

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:

Disable CDN on SSL pages

Useful Resources

If you want to learn more about Amazon Cloudfront and how to set it up correctly, we recommend these articles:

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:

Troubleshooting

If you experience any issues, please review these docs: