CDN not working, files not sent to CDN

If, after activating the CDN option and entering your CNAME in WP Rocket, you see that your files are not being served from your CDN, please check the following. 

In your WordPress dashboard, go to Settings → General and check how your site URL is written: Does it have the www in front of the domain?

Technically speaking, the www and non-www version of your domain name are 2 separate domains. When re-writing the URLs of your files to your CDN, WP Rocket looks for the domain version as specified in your Site Address settings. Any other version is considered external and will not be re-written with the CDN url.

So if you use www in your site settings, you should make sure all links to your files also contain it, otherwise they will not be re-written to your CDN.

In this example, there are two images. One image URI uses http://www.lucybeer.com and one uses http://lucybeer.com.

Only the the first image will get re-written to the CDN, the other will not because of the lack of www:

CDN for logged-in users

The replacement of your domain URL to the CDN URL will only apply on cached pages. On pages that are not cached (for whatever reason), regular WordPress URLs get applied for images, CSS, and JavaScript files.

Logged-in users will only see files from the CDN if the User Cache option is enabled.

Please note: If you're using a custom media uploads directory, the wp_uploads_dir function is used to determine the correct path.