This is Concrete CMS add-on to purge Cloudflare cache as well as Concrete CMS cache.
It saves time from logging into Cloudflare dashboard to clear Cloudflare cache. You only need to visit Concrete CMS dashboard to press button to clear cache altogether.
- Concrete CMS v8.0 and later
- tested with Concrete CMS V8.5.12 and later
- Tested with PHP 7.4
- Cloudflare
- Auth Key
- Auth Email
- Zone ID
First, you get API keys from Cloudflare, then install the add-on, save the API key.
- Login to Cloudflare dashboard
- Click your
website
domain - Visit overview page
- Locate
API
in the sidebar - You find
Zone ID
. Save it
- Visit My Profile page
- Find & visit API Tokens page
- Click
Create Token
button - Find
Create Custom Token
at the bottom of the list and clickGet started
- Create Custom Token
- Name your token accodingly (e.g, example.com cache clear)
- In
Permissions
- Select
Zone
in the 1st box - Select
Cache Purge
in the 2nd box - Select
Purge
in the last box
- Select
- Zone Resources
- Select
Include
- Select
Specific Zone
, then select your domain.
- Select
- Client IP Filtering
- If your web server has specific public IP address, you can set it to enfource the security of your API key
- Click
Continue to summary
- Check the API key summary then click
Create Token
- Make a note of your API tokens, YOU WILL NEVER BE able to get it again!
- Auth email is the email address that you signed in to Cloudflare to create the API key.
- Upload the folder
cdn_cache_purge_cloudflare
underpackages
folder of your Concrete CMS - Install the package
- via Dashboard
- via CLI
- V8 and earlier
concrete/bin/concrete5 c5:package:install cdn_cache_purge_cloudflare
- V9 and later
concrete/bin/concrete c5:package:install cdn_cache_purge_cloudflare
- V8 and earlier
- Visit [Dashboard] -> [System and Setting] -> [Optimization]
- Visit
Cloudflare
page- URL:
[Your Site]/index.php/dashboard/system/optimization/cloudflare/
- URL:
- Enter
Cloudflare Auth Key
,Cloudflare Auth Email
andCloudflare Zone ID
- Click Save
- Visit [Dashboard] -> [Optimization] -> [Clear Cache] page
- URL:
[Your site]/index.php/dashboard/system/optimization/clearcache/
- URL:
- Press clear cache
- You can visit [Dashbord] -> [Reports] -> [Logs]
- URL:
[Your Site]/index.php/dashboard/reports/logs/
- Cache purge log will be saved at NOTICE level. You can check the result with ID.
- URL:
If you switch the logging level to Debug, this add-on will also save the actual API call.
It is great way to troubleshoot when having issue clearing the cache.
Log level setting page is located at [System and Settings] -> [Environment] -> [Logging Settings]. [Your Site]/index.php/dashboard/system/environment/logging/
WARNING: It will also save API key in the log. You MUST make sure to clear the log after testing.
- This add-on hooks Concrete CMS's
on_cache_flush
event. - When Concrete CMS receives to clear cache, it will send a simple API call to Cloudflare to clear the cache of specified zone.
- Config text will be saved at
application/config/generated_overrides/cdn_cache_purge_cloudflare/cloudflare.php
Version | Date | Note |
---|---|---|
0.9.2 | Dec 24, 2023 | Initial public release of this add-on. |
- Katz Ueno (@katzueno), Macareux Digital, Inc.
- Hishikawa Takuro (@HissyNC), Macareux Digital, Inc.
- This add-on is based on his CDN Cache Purge for CloudFront add-on.
- Icon was generated by Cloudflare AI using stable-diffusion-xl-base-1.0 model