Setup push invalidation for Cloudflare
Push invalidation automatically purges content on the customer's production CDN (e.g. www.yourdomain.com
), whenever an author publishes content changes.
Content is purged by url and by cache tag/key.
Push invalidation is configured by adding specific properties to the project's configuration:
- If you are using the configuration service, see here how to update the CDN configuration.
- Otherwise, see here for document-based CDN configuration.
Configuration properties:
key | value | comment |
cdn.prod.host |
<Production Host> |
Host name of production site, e.g. www.yourdomain.com |
cdn.prod.type |
cloudflare |
|
cdn.prod.plan |
e.g. free |
values: default: |
cdn.prod.zoneId |
<Cloudflare Zone ID> |
ID of production zone |
cdn.prod.apiToken |
<Cloudflare API Token> |
To create an API Token,
- go to API Tokens
- click on "Create Token",
- go to "Create Custom Token" at the bottom and click on "Get started"
- enter a token name (e.g.
"Production Site Purge Token"
), - Permissions: "Zone", "Cache Purge", "Purge"
- Zone Resources: "Include", "Specific zone", "<your production zone>"
- click on "Continue to summary"
- click on "Create Token",
- copy the generated token value.
You can validate the credentials with this tool.