cs-icon.svg

Revalidate CDN Cache

CDN cache revalidation is a feature that allows you to revalidate the cache for your environment when you modify the content or configuration. An environment includes multiple domains sharing the same CDN settings. When you revalidate the cache, the CDN fetches the latest content from the origin server, ensuring visitors see the latest version. By revalidating, you prompt the CDN to check if any content across all the domains of your environment has been modified or updated since it was last cached. If so, the CDN fetches the new content and updates its cache; if not, it continues to serve the cached version.

Note: Each time you redeploy your environment, Launch automatically purges the CDN cache. This ensures that users always receive the most up-to-date content.

Prerequisites

  1. Contentstack account
  2. Access to Launch for your organization

CDN Cache Revalidation Fields

To revalidate the CDN cache for a website, you need to provide:

  1. Revalidation path

    The revalidation path is the URL path that you can revalidate across all the domains in your environment. For example, if you have an environment that consists of https://example.com, https://example.net, and https://example.org, and your revalidation path is /blog, then the CDN revalidates https://example.com/blog, https://example.net/blog, and https://example.org/blog.

  2. Is Prefix

    The boolean value Is Prefix indicates whether you can revalidate only the exact path or also all the nested paths under it. For example, if your revalidation path is /blog and you set Is Prefix to true, then the CDN revalidates https://example.com/blog, and also all the pages under it, such as https://example.com/blog/post1, https://example.com/blog/post2, etc. If you set Is Prefix to false, then the CDN revalidates only https://example.com/blog. Similarly, CDN cache will also be revalidated for all other domains that are a part of the same environment.

Revalidate CDN Cache using Automate

To revalidate the CDN cache for an environment, you can use the Revalidate CDN Cache action in the Automate Launch connector.

Additional Resource: For detailed information on creating the Revalidate CDN Cache action in Automate, refer to the Launch Connector document.

Examples of Revalidating CDN Cache

  • Revalidating a single page: To revalidate a single page on your website, for example, https://www.example.com/blog/my-blog-post, you can provide the path /blog/my-blog-post and set Is Prefix value to false.
  • Revalidating an entire directory: To revalidate an entire directory of pages, you can provide the directory path and set Is Prefix value to true. For example, if you have a directory of blog posts at https://www.example.com/blog, you can provide the path as /blog and set Is Prefix to true.
  • Revalidating nested paths of a category: If your website has nested paths (i.e., paths that contain other paths), you can use this feature to revalidate both the parent and child paths. For example, to revalidate the parent page https://www.example.com/category/my-category and the child page https://www.example.com/category/my-category/products, you can provide the path /category/my-category and set Is Prefix to true.
  • Revalidating the entire site: To revalidate the cache of an entire website without doing a fresh deployment, you can provide the revalidation path as “/“ with Is Prefix set to true.

Limitation

Revalidations are currently rate-limited to 1000 executions for 24 hours a day per organization.

Note: If you are revalidating a specific path, an entire directory, or the entire environment, in all cases, it accounts for a single execution per revalidation trigger for a path (1 trigger = 1 revalidation irrespective of path and domains).

Was this article helpful?
^