Configuring push invalidation for BYO production CDN
Push invalidation automatically purges content on the customer's production CDN (e.g. www.yourdomain.com) whenever content or code changes are made on AEM origins with the main branch in the host name (e.g. main--site--org.aem.live). By default, changes pushed to other origins do not trigger push invalidation. If you want to enable push invalidation on a production-like CDN pointing to a different branch, see Optional Branch Configuration.
Content is purged by URL and by cache tag/key.
Setup at a glance
Setting up push invalidation requires 2 steps:
- Configure your production CDN by setting the project's production CDN configuration. Push invalidation is supported for the following CDN vendors:
- Send the Opt-In Request Header from your production CDN to the origin.
Optional settings are described under Additional Configuration:
Opt-In Request Header
The production CDN needs to send the following opt-in header to the origin in order to enable long cache TTLs:
X-Push-Invalidation: enabled
Additional Configuration
The following settings are optional.
Store credentials as secrets
Instead of storing a purge credential as plain text in the CDN configuration, you can store it as a secret and reference it from the configuration. This keeps the credential value out of the configuration, which is readable by everyone with access to it.
The following credential fields accept a secret reference:
- Fastly:
authToken - Cloudflare:
apiToken - Akamai:
clientSecret,clientTokenandaccessToken - CloudFront:
accessKeyIdandsecretAccessKey
To use a secret:
- Create a key secret that holds the credential value. Secrets can be created for a site or for the whole organization.
The response contains thecurl --request POST \ --url https://admin.hlx.page/config/{org}/sites/{site}/secrets.json \ --header 'content-type: application/json' \ --data '{ "description": "Production CDN purge token", "value": "{credential value}" }'idof the new secret:
For an organization secret, use{ "id": "Zk3q9XvT2mLpR7wA", "type": "key", "description": "Production CDN purge token", "created": "2026-05-12T09:41:23.000Z", "lastModified": "2026-05-12T09:41:23.000Z" }https://admin.hlx.page/config/{org}/secrets.json. - Set the credential field in the production CDN configuration to
secret:followed by theidof the secret. For example, for Fastly:{ "prod": { "host": "{production host}", "type": "fastly", "serviceId": "{serviceId}", "authToken": "secret:Zk3q9XvT2mLpR7wA" } }
Only the fields listed above accept secret references. Other properties, such as host, serviceId, zoneId or endpoint, are stored as plain values.
If the referenced secret does not exist, the credential is treated as not set. Push invalidation then fails for this CDN until you correct the reference.
Optional Branch Configuration
By default, code changes trigger push invalidation for the production CDN only if they are made on the main branch.
If you use a production-like CDN for a non-production environment with a different branch as its origin, set cdn.prod.branch to that branch name in the environment’s CDN configuration. For example, if the CDN uses stage--site--org.aem.live as its origin, add:
{
"cdn": {
"prod": {
...
"branch": "stage"
}
}
}
This example shows only the branch setting; retain the other properties required for your CDN provider.
The configured branch must match the branch in your CDN’s origin hostname.
Previous
Placeholders
Up Next