How to Serve WordPress HTML Pages as Static Files via CloudFlare CDN

There are many WordPress plugins that cache full HTML pages. Some are using disk, some memory, but what is common for them is that they are using your server resources.

CloudFlare offers many services that enhance sites and among them is CDN (Content Delivery Network) that caches and serves content from its servers. By default, this feature is enabled for static files, like images, CSS or Javascipt, though it is possible to enable serving of all HTML pages this way. That means that cache is not stored on your server and as a plus it is served from CDN.

Problem with this is that on many times you want to remove some content from cache. For example, you publish a post and you want to have fresh copy of home page. There are a few plugins that use CloudFlare API to remove or purge content but they have a few problems: they include other features offered by CloudFlare, badly coded, not extensible, or limited purging coverage.

To solve this, I created Purge Cache for CloudFlare and its premium extension Purge Cache for CloudFlare Plus. These are written from ground up with some things in mind: to be simple, extensible, lightweight, doing only one thing.

Free basic version cleans cache in scenarios that are most common for most sites. Premium extension goes even further and cleans cache of even more pages and for more things, not just new/edited post.

When setup right, CloudFlare cache and CDN could greatly improve speed of your site, while at the same time not using any of your server resources.

Leave a Reply

Comment Guidelines:
  • Your email address will not be published
  • Fields marked with * are required
  • If you want your picture next to comment, open an account at Gravatar
  • If you want to know if someone replied to your comment, check “Notify me of followup comments via e-mail”
  • You can use these HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>