Cloudflare is an amazing platform that offers a CDN, security features, and free SSL. In this topic, we are focusing on CDN. Cloudflare does an amazing job caching static pages on their global content delivery network, however not so great caching WordPress sites. This is why you may or may not notice a huge difference when using Cloudflare vs no Cloudflare. That is where this awesome tool comes in. This plugin serves a static copy of your site through all of Cloudflare’s datacenters. That way your site can still load fast even from places like Australia or India. Normally this feature is only available with the Cloudflare APO tool (automatic WordPress optimization) inside the Cloudflare WordPress plugin which costs $5 a month (the plugin is free but to use the APO tool, you would need to pay $5 a month). However thanks to Optimole (the developers of this plugin and the awesome Optimole image optimization plugin) this is now free.
Disable Caching from any caching plugins (if installed) to prevent conflict. This plugin automatically caches your site on cloudflare datacenters.
Get your Cloudflare Global API key here (go to your Profile and API tokens): https://dash.cloudflare.com/profile/api-tokens
IMPORTANT: Disable Mirage and Rocket Loader. You can leave it on (many people have success with leaving it on), however my images did disappear when turning Rocket loader on.
Go to Plugins < Add New and install the Cloudflare Super Page Cache plugin.
Go to Settings < Cloudflare Super Page Cache and follow the instructions.
Click on Enable Page Cache
Click on test page cache and verify it is working. Another way is to go to your site and press F12 (on chrome). Then click on Network and refresh the page. It should say:
cf-cache: HIT (not DYNAMIC. If it does say that then leave a comment below)
- When you verify page cache is working, go to Advanced and click on Start Preloader. This will preload a static copy of your site on all of Cloudflare’s datacenters without the need for visitors in that region.
DONE. That’s it
Optional Cache Settings:
Overwrite the cache-control header for WordPress’s pages using web server rules: YES
Enable fallback page cache: YES
Add browser caching rules for static assets: YES
If you have any performance plugins listed in the Third Party tab, please follow the instructions there for your plugin.
There are 2 ways of purging cloudflare cache. One is on the top toolbar in WordPress and the other is in Cloudflare under Cache. This plugin does automatically purge cache when you edit a page/post and you can manually purge Cloudflare Cache on certain pages/posts.
If you have any questions or concerns or need help with something related to this plugin (or Cloudflare) just leave a comment below.