Purges your Heroku application's Cloudflare cache on deployment.
This buildpack makes use of Heroku's built-in multi buildpack functionality to make a HTTP DELETE request to the Cloudflare purge all files API. Each time you deploy your Heroku app, the cache will be cleared.
You will need:
- Your Cloudflare API key and email address
- The Zone ID of the site that Cloudflare is caching
Run the following against your Heroku application:
heroku config:set CF_EMAIL=email@example.com
heroku config:set CF_ZONE_ID=my_zone_id
heroku config:set CF_AUTH_KEY=my_cloudflare_api_key
heroku buildpacks:add https://github.com/jamesmartin/cloudflare-cache-purge-buildpack.git
git push heroku master
The Cloudflare Zone ID for your site can be obtained via the API:
- Clone this repository locally
- Edit the cf file to include your Cloudflare API key and email address
- Run the
zones
command:
$ ./cf bin/zones
- Find the Zone ID of your site in the JSON output of
zones
. E.g:
{
"result": [
{
"id":"this-is-your-zone-id",
"name":"example.com",
"status":"active",
...