Wordpress Images, css and JS not cached /served via CDN

Hi all,

i am now trying for hours to fix that my images, CSS and JS will not be cached / served via CDN. Does anyone have an idea what i am missing?

Ps. Cache Level in Header for Cloudflare is not active.

It would be awesome if someone could help me out here, i am freaking out :slight_smile:
Thanks in advance!

Wordpress + Siteground + Cloudflare Pro + Cloudflare Plugin installed
Page rules and results from GTMetrix:

This has come up many times:

1 Like

Thanks for your answer!
And correct, but if u look into the Header, there is no Cloudflare CDN etc.
Cache Level is not active.

You don’t need the Page Rule on /wp-content/uploads, as these are files that are cached by default. Unless you want to change other parameters.

Also, the order of Page Rules matter. You should place them like this:

1 Redirect
2 /wp-admin
3 /wp-login
4 /xmlrpc
5 /wp-content
6 / should be last!

Only one page rule is triggered by any URL (except that the redirect will subsequently trigger the new URL)

If your files under wp-content/uploads are not being cached, you need to check your WP installation and theme/plugins. Cloudflare is not going to cache if HTTP headers tell it otherwise. Check your caching plugin specs.

1 Like

Thanks for the advice.
We have solved the issue.

FAKT: the CDN was NOT working -> Cloudflare works only with www. domain. If you have just https:// like i had, the cdn is not working.

I have added www. and now its working correctly- Even with GT Metrix.

Anyway, thanks for your help guys!

Because you don’t have the naked domain set to :orange:. I don’t use ‘www’ for my domains, and have www and the naked domain set to :orange:

But because you have a CNAME setup, I guess yours is limited to ‘www’ coverage.

And since trebeli.com is not going through Cloudflare, none of those naked domain rules are going to take effect. Especially considering that the naked domain redirects to ‘www’.


Your are right.
So if i understand you correctly, i have to add www. to all rules too?
Also i could delete the redirect, correct?

Since you have a bunch of rules available, I’d put a redirect first:
Match trebeli.com/* and add a setting for Forwarding URL to https://www.trebeli.com/$1 (the $1 is in case your site used to be reachable without the www and you want to redirect to the same location with the www).

And see if you can set the naked domain to :orange:. Then Cloudflare will handle the redirect, which is faster.

And, yes, your rules need www in front…except for the non-www redirect I just described.

1 Like

Thank you @sdayman!

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.