Developer Reece Alexander of Stead Lane (SilverStripe Professional Partner) has created an innovative module that is proving to have great success: SilverStripe-CloudFlare. The module will make life much easier for content managers.
What is CloudFlare?
CloudFlare is a content delivery network (CDN)—a distributed network of servers that helps improve page load speeds, reduce bandwidth and CPU (central processing unit) usage on the server by caching website content.
What does SilverStripe-CloudFlare do?
SilverStripe-CloudFlare clears the cache and allows you to see changes instantly as you make them. In a typical CDN provided website setup, you can expect a website change to take hours, or even days, to show for your end users. These days are gone: SilverStripe-CloudFlare uses the CloudFlare API to purge pages that have been changed as soon as you publish them; you don’t have to log into the CloudFlare dashboard and purge the cache yourself.
The team at Stead Lane have shared this module within the wider SilverStripe open source community for anyone to access. The intention of this module was to eliminate a waiting process and improve efficiency while using SilverStripe CMS. Immediate positive feedback from the community has proved its intent.
Dynamic zone ID detection: You can have multiple domains under your CloudFlare account. This module dynamically retrieves the CloudFlare Zone ID for the domain you have accessed the CMS administration with. You need to make sure this domain is correctly registered under your CloudFlare account.
- If you modify the title or URL of any page, all cache for the Zone will be purged
- If you modify the contents of any page, only the cache for that page will be purged
- If you modify any page that has a parent, the page you modified and all of its parents will be purged too
This module only supports installation via composer:
composer require steadlane/silverstripe-cloudflare
/dev/build afterwards and
?flush=1 for good measure for SilverStripe to become aware of this module.
Configuration for this module is minimal, you need only define two constants in
If you have multiple domains registered under a single account in CloudFlare, the module is versatile in automatically recognising the Zone ID that is to be used alongside the domain the module is installed on. Other than the two initial configuration settings to set up the module, there is no further setup required, making it practical and easily accessible.
It is recommended that the user adds these cache rules to CloudFlare cache rules:
|It is outside the scope of this module to handle cache purging for drafts. Drafts should never need to be cached as they're not usable on the front end|
|Prevents caching of the login page etc|
|Prevents caching of the Administrator Pane|
|Prevents caching of the development tools|
The development of this module and its accessibility to the wider SilverStripe open source community will improve the efficiency of content creators and content managers globally.