Purge your Cloudflare cache automatically during a deployment

Launches and New Features

We've recently released a new feature to the DeployHQ platform - the ability to purge a Cloudflare cache before or after a deployment!

Previously, this could be achieved using an HTTP POST notification, but now with a direct integration with Cloudflare's services, you can configure it much more easily, and with the added bonus that you can tell the notification to just clear any cached files that were only uploaded in the deployment, rather than your entire app each time.

Setting up your new notification

To set up a new notification, click the Notifications link on the left hand side of your project, then the New Notification button to get started.

New notification

Choose Cloudflare in the Service dropdown, then enter the appropriate Zone ID and Asset URL Prefix - the URL that should be prefixed to any asset paths from the source repository (such as www.example.org).

Next enter your Email Address and API Key that's used to connect to Cloudflare, then enable the Purge Everything option if you want to clear the cache for the zone on every deployment. Otherwise, DeployHQ will just send a request to invalidate only the files that were changed in the deployment.

Cloudflare configuration

Choose when to send notifications, and choose any servers you wish to send notifications for, or keep the Send notification when any server or group deployed? option checked if you want clear the cached files on deployments to any server in the project.

When to send the notification

Once you're done, just click Create Notification.

That's it, you'll now find that when a deployment has finished any assets cached in your Cloudflare zone will be cleared automatically. If you have any questions, please don't hesitate to get in touch.

A little bit about the author

I'm Adam W, or as everyone prefers to call me - Batman. I get a lot of satisfaction out of helping our customers and am committed to making their customer experience as positive as possible. When not offering support to our customers, you'll find me gaming, listening to music or running.

Proudly powered by Katapult. Running on 100% renewable energy.