Purging the CDN cache cdn-purge-cache

NOTE
This feature is not yet generally available. To join the early-adopter program, email aemcs-cdn-config-adopter@adobe.com.

Purging removes an object from the Adobe CDN cache, resulting in future requests proceeding to the origin as a cache miss, rather than being served from cache.
AEM as a Cloud Service allows you to configure a Purge API Token, which can then be used in API calls. Read the Configuring CDN Credentials and Authentication article to learn how to configure this token using the Cloud Manager Configuration Pipeline Authentication directives.

There are three supported purging variations:

All purge variations share the following:

  • The HTTP method must be set to PURGE.
  • The URL can be any domain associated with the AEM service that the purge request is intended for.
  • The X-AEM-Purge-Key must be provided in a HTTP header.
CAUTION
Purging the CDN cache, especially with the hard flag, will increase traffic at the origin and could lead to an outage when not executed properly.

Single URL purge single-purge

You can purge a single resource at a time as follows:

curl
-X PURGE "https://publish-p1234-e5467.adobeaemcloud.com/resource-path" \
-H 'X-AEM-Purge-Key: <my_purge_key>' \
-H 'X-AEM-Purge: soft'

As shown in the example above, you can optionally specify if the CDN should perform a hard purge (default) or a soft purge on the cached objects.

The default hard purge makes the content immediately inaccessible to new requests until the content is retrieved from the origin. Soft purge marks content as stale, but still serves it to clients so they do not need to wait until the content is retrieved from the origin.

Surrogate key purge surrogate-key-purge

Surrogate keys are unique identifiers that you use to purge a set of content. They are applied to content by adding a Surrogate-Key header to the response. One or more surrogate keys can be referenced in a purge API call.

curl
-X PURGE "https://publish-p1234-e5467.adobeaemcloud.com" \
-H 'X-AEM-Purge-Key: <my_purge_key>' \
-H "Surrogate-Key: my-surrogate-key"
-H "X-AEM-Purge: soft" #optional

The Surrogate-Key(s) are separated by spaces. Similarly to the single URL purge, you can configure either a hard or a soft purge.

Full purge full-purge

You can perform a full purge of all cached resources as follows:

curl
-X PURGE "https://publish-p1234-e5467.adobeaemcloud.com" \
-H 'X-AEM-Purge-Key: <my_purge_key>' \
-H "X-AEM-Purge: all"

Be aware that the X-AEM-Purge header must include the ‘all’ value.

Interactions with Apache/Dispatcher layer apache-layer

As described in the Content Delivery Flow article, the CDN retrieves content from the Apache/Dispatcher layer, if the cache has expired. This implies that before purging a resource at the CDN, you should ensure that a fresh version of the content is also available at the Dispatcher. For further details also see Dispatcher Cache Invalidation.

recommendation-more-help
fbcff2a9-b6fe-4574-b04a-21e75df764ab