Serving your WordPress Site on Cloudflare Servers

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.

Prerequisites:

  • 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.

Lets start:

  1. Go to Plugins < Add New and install the Cloudflare Super Page Cache plugin.

  2. Go to Settings < Cloudflare Super Page Cache and follow the instructions.

  3. Click on Enable Page Cache

  4. 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)

  1. 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

Integrations:

If you have any performance plugins listed in the Third Party tab, please follow the instructions there for your plugin.

Purging Cache:

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.

3 Likes