That would be an option, though most images on the site are create dynamically, with the expectation that a CDN or Cloudflare would cache them. If I was to go into Development mode the server wouldn’t stay online long.
I did find a solution, using a PHP class on github, a couple PHP edits, and local coding.
We take over 1.5M requests to dynamic images per day, and GD library struggles to keep up at times. We also take another 1M more requests to our embeds. And so on. We used to run a loadbalanced system, but shrank it down with the help of cacheing and CDNs.
Here is the Github:
The only flaw is that it has issues if you have more than one zone/site on Cloudflare under same account. The two fixes is just supply your ZoneID, instead of attempting to get zoneid each API call, or you can add this:
You don’t use the $identifier function provided, but instead just add this to your file that is including the class (after the included class of course):
That’s the zone id, then can use rest of API is exampled.
I’ve added a page rule to Cloudflare, where if “/clear/” exists in URL, it bypasses. /clear/ launches a PHP script that takes the page url (without /clear/) and uses the API to clear that exact URL.
But, i’m now adding to other scripts, so any time we update a content page (or pages), it loops them through cloudflair purge API.