CloudFlare Purge (CFPurge) is a plugin for the Expire module which enables it to clear specific pages from the CloudFlare CDN when you update, delete or add a page.

CloudFlare with "cache everything" enabled provides the ultimate performance for your anonymous users, down to a 20 millisecond response time and extremely fast transfer rate. When you enable this setting your site can instantly handle millions of anonymous users, even if you're using a shared host.

By the way, Google also likes really fast websites, so it also improves your SEO.

Requirements

  • A CloudFlare account. Make sure you create Page Rules for directories that you don't want to cache, such as /services/service, in case you have a service set up using that path. The free package lets you cache everything and also let's you create a few page rules.
  • PHP with curl enabled. This module uses curl for issuing the http POST requests to CloudFlare.
  • The Expire module. You need to enable External expiration under Administration » Configuration » System » Cache Expiration (admin/config/system/expire).

Installation

  • If using Drush, drush dl cfpurge and then drush en cfpurge otherwise unpack, place and enable just like any other module.
  • Navigate to Administration » Configuration » Development » Performance » CloudFlare Purge Settings (admin/config/development/performance/cfpurge) and enter your CloudFlare info.
  • Navigating to Administration » Configuration » Development » Performance (admin/config/development/performance) and set the Expiration of Cached Pages to 3 hours or more. This means that CloudFlare will store your page for 3 hours or more if you don't edit or delete it beforehand. You can ignore the other settings on this page. If you enable local caching--which wont be necessary--your local cache will be purged as well.

Note

Remember that when using CloudFlare all requests will come from one IP, to get the users' actual IP you will have to add this line to the bottom of your settings.php file:
$_SERVER['REMOTE_ADDR'] = !empty($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];

Project information

Releases