Invalidate the CDN cache by way of Dynamic Media invalidating-cdn-cache-for-dm-assets-in-aem-cs

Dynamic Media assets are cached by the CDN (Content Delivery Network) for fast delivery to your customers. However, when you make updates to those assets, you want those changes to take effect immediately on your website. Purging or invalidating the CDN cache lets you quickly update assets that are delivered by Dynamic Media. You no longer have to wait for the cache to expire using a TTL (Time To Live) value (default is ten hours). Instead, you can send a request from within the Dynamic Media user interface to have the cache expire within minutes.

NOTE
This feature requires that you use the Adobe-bundled CDN that comes with Adobe Experience Manager Dynamic Media. Any other custom CDN is not supported with this feature.

If you have enabled Smart Imaging on your account and you are using the Adobe-bundled CDN, you can purge all URLs with different query strings by purging the single base URL.

For example, invalidating https://weekendsite.scene7.com/is/image/<CUSTOMER-NAME>/image, also invalidates the following URLs:

  • https://weekendsite.scene7.com/is/image/<CUSTOMER-NAME>/image
  • https://weekendsite.scene7.com/is/image/<CUSTOMER-NAME>/image?wid=300
  • https://weekendsite.scene7.com/is/image/<CUSTOMER-NAME>/image?$PLP$
  • and so on.

This invalidation, however, is not the case for generic domains that do not support Smart Imaging, such as s7d1.scene7.com. Such domains still need the full URL to have invalidation work successfully.

To invalidate the CDN cache by way of Dynamic Media:

Part 1 of 2: Creating a CDN Invalidation template

  1. In Adobe Experience Manager as a Cloud Service, go to Tools > Assets > CDN Invalidation Template.

    CDN Validation feature

  2. On the CDN Invalidation template page, do one of the following options based on your scenario:

    table 0-row-2 1-row-2 2-row-2
    Scenario Option
    I have already created a CDN invalidation template in the past using Dynamic Media Classic. The Create Template text field is pre-populated with your template data. In such case, you can either edit the template, or continue to the next step.
    I have to create a template. What do I enter? In the Create Template text field, enter an image URL (including image presets or modifiers) referencing <ID>, instead of a specific image ID as in the following example:
    https://my.publishserver.com/is/image/company_name/<ID>?$product$
    If the template contains just <ID>, then Dynamic Media fills in https://<publishserver_name>/is/image/<company_name>/<ID> where <publishserver_name> is the name of your Publish Server that is defined in General Settings in Dynamic Media Classic. The <company_name> is the name of your company root associated with this Experience Manager instance, and <ID> is the selected assets through the asset picker to be invalidated.
    Any presets/modifiers following <ID> are copied as-is in the URL definition.
    Only images–that is, /is/image–can be auto formed based on the template.
    For /is/content/, adding assets such as videos or PDFs using the asset picker does not auto generate URLs. Instead, you must specify such assets either in the CDN Invalidation template, or you can manually add the URL to such assets in Part 2 of 2: Setting CDN Invalidation options.
    Examples:
    In this first example, the invalidation template contains <ID> along with the asset URL having /is/content. For example, http://my.publishserver.com:8080/is/content/dms7snapshot/<ID>. Dynamic Media forms the URL based on this path, with <ID> being the assets selected through the asset picker that you want invalidated.
    In this second example, the invalidation template contains the full URL of the asset used in your web properties with /is/content (not dependent on the asset picker). For example, http://my.publishserver.com:8080/is/content/dms7snapshot/backpack where backpack is the asset ID.
    Asset formats that are supported in Dynamic Media are eligible for invalidation. Asset file types that are not supported for CDN invalidation include PostScript®, Encapsulated PostScript®, Adobe Illustrator, Adobe InDesign, Microsoft® Powerpoint, Microsoft® Excel, Microsoft® Word, and Rich Text Format.

    • When you create the template, but sure you pay careful attention to syntax and typos; Dynamic Media does not do any template validation.
    • The CDN Invalidation Template can save text up to 2500 characters.
    • Specify URLs for image smart crops either in this CDN Invalidation template, or in the Add URL text field in Part 2: Setting CDN Invalidation options.
    • Each entry in a CDN Invalidation template must be on its own line.
    • The following CDN Invalidation template example is for demonstration purposes only.

    CDN Invalidation Template - Create

    note note
    NOTE
    The CDN Invalidation Template can save text up to 2500 characters.
  3. In the upper-right corner of the CDN Invalidation template page, select Save, then select OK.

    Part 2 of 2: Setting CDN Invalidation options

  4. In Experience Manager as a Cloud Service, go to Tools > Assets > CDN Invalidation.

    CDN Validation feature

  5. On the CDN InvalidationAdd Details page, select the assets for CDN invalidation.

    CDN Invalidation - Add Details

    note note
    NOTE
    If you decide to leave the options Invalidate asset associated image presets in CDN and Invalidate based on template unchecked, then the base URL of the selected assets is formed for invalidation. Use this option arrangement for images only.
    table 0-row-2 1-row-2 2-row-2 3-row-2 4-row-2
    Option Description
    Invalidate asset associated image presets in CDN (Optional) When you check this option, selected assets and all their associated image preset URLs are auto-formed for cache invalidation.
    Assets and their associated pre-defined preset URLs are auto formed for invalidation. This option works only for image assets.
    Invalidation based on template (Optional) Check this option to use only the defined template for URL formation.
    Add Assets Use the Asset Picker to select assets you want to invalidate. You can select either published or unpublished assets.
    Caching at the CDN is URL-based, not asset-based. Therefore, it is necessary for you to be aware of the complete URLs that are on your website. After you determine those URLs, you can add them to the template. Then, you can select and add those assets and invalidate the URLs in one step.
    Use this option with Invalidate asset associated image presets in CDN, or Invalidation based on template, or both.
    Add URL Manually add or paste full URL paths to Dynamic Media assets whose CDN cache you want to invalidate. Use this option if you did not create a CDN Invalidation Template in Part 1 of 2: Creating a CDN Invalidation template, and have only a few assets to invalidate.
    Important: Each URL that you add must be on its own line.
    You can invalidate up to 1000 URLs at a give time. If the number of URLs in the Add URL text field is greater than 1000, you are unable to select Next. In such cases, you must select X to the right of a selected asset or a manually added URL to delete it from the invalidation list.
    Specify URLs for image smart crops either in the CDN Invalidation template, or in this Add URL text field.
  6. Near the upper-right corner of the page, select Next.

  7. On the CDN Invalidation - Confirm page, in the URLs list box, you see a list of one or more URLs generated from the CDN Invalidation Template you created earlier and the assets you just added.

    For example, using the CDN Invalidation Template example that was shown in the steps earlier, suppose you added a single asset named spinset. When you go to Tools > Assets > CDN Invalidation, it results in the following five generated URLs in the CDN Invalidation - Confirm user interface:

    CDN Invalidation - Confirm

    If necessary, select X to the right of a URL to delete it from invalidation process.

  8. Near the upper-right corner of the page, select Submit to begin the CDN invalidation process.

Troubleshoot CDN Invalidation errors

In all cases, either the entire batch is processed for invalidation, or the entire batch is failed.

Error
Explanation
Failed to retrieve URLs for selected assets.
Occurs if any of the following scenarios are met:
– A Dynamic Media configuration is not found.
– There is an exception while retrieving a service user through which the Dynamic Media configuration is read.
– The publish server or the company root used to form the URLs is missing in the Dynamic Media configuration.
Some URLs are not defined correctly. Correct and resubmit.
Occurs if the IPS CDN cache invalidation API returns an error. The error indicates that the URL refers to a different company or the URL is not valid as per the validation done by the IPS cdnCacheInvalidation API.
Failed to invalidate CDN cache.
Occurs if the CDN cache invalidation request fails for any other reason.
No URLs entered to be invalidated.
Occurs if there are no URLs present in the CDN InvalidationConfirm page, and you select Submit.
recommendation-more-help
fbcff2a9-b6fe-4574-b04a-21e75df764ab