This extension purges Cloudflare cache when updating pages or re-uploading images, with the primary aim of clearing image cache.
It's recommended to read the page Using CloudFlare with MediaWiki – harugon's blog before installation.
- PHP 7.4
- MediaWiki 1.35
Download the file Cloudflare-{version}.tar.gz
from the URL Releases · harugon/mediawiki-extensions-cloudflare and extract it to the extensions directory.
Add the following to LocalSettings.php along with your Cloudflare API information:
wfLoadExtension('Cloudflare');
$wgCloudflareEmail = '';
$wgCloudflareAPIKey = '';
$wgCloudflareZoneID = '';
Variable | Default value | Notes |
---|---|---|
$wgCloudflareEmail |
"" |
Your email used for logging in Cloudflare |
$wgCloudflareAPIKey |
"" |
API key (API token - Cloudflare → Your global API key is needed) |
$wgCloudflareZoneID |
"" |
Site (URL) ID (You can get it from the dashboard of the site) |
$wgCloudflarePurgePage |
false |
Purge cache when articles are updated |
$wgCloudflarePurgeFile |
true |
Purge cache when files (images) are updated |
|
If enabling $wgCloudflarePurgePage
, it's necessary to set a Page Rule of Bypass Cache on Cookie. (Only available on Business and Enterprise plans.)
- API Rate limits
- When Varnish is in place... (There's a possibility that Cloudflare may disappear first in the sequence Cloudflare->Varnish->origin?)
Cloudflare, the Cloudflare logo, and Cloudflare Workers are trademarks and/or registered trademarks of Cloudflare, Inc. in the United States and other jurisdictions.