It sounds nasty but with my aggressive caching I need a way to purge the cache when I publish a new blog post. An automated way would be best. Thus; auto-purge.

Enter Zapier. The IFTTT for webhooks.

The process works like this:

  1. I publish a new post
  2. Ghost fires off a webhook to Zapier
  3. Zapier receives this webhook, and sends a request to Cloudflare via API
  4. Cloudflare purges

In order to set this up like I have, you'll need a few things;

  1. A Zapier account
  2. A Cloudflare account
  3. The email address for your Cloudflare account
  4. Your site’s Zone ID
  5. Your Cloudflare API key

Once you've got everything prepared, head on over to Zapier and create a new Zap.


You'll want to find Ghost as the trigger app.

And set the trigger to a new story. Defining the published status comes a bit later in the setup.

Connect to your Ghost instance. You'll need to define a full URL, https:// and all.

And here is where we set the trigger status to be published. There are others available but published is the status we care about for this Zap.


Cloudflare doesn't have an app in Zapier, so we'll have to make do with a webhook...

... a custom webhook!

When setting up the webhook it needs to be a POST request to URL:<Zone ID>/purge_cache

Ignore data pass-through.

Set the data to the following JSON;


And add in two headers, their keys are X-Auth-Email and X-Auth-Key.

Once that's done hit continue and test the webhook.


With all of that hard work out of the way your super cache purging adventure can begin.

Happy blogging!