#Next 13 Invalidating Cache with Headless CMS
1 messages · Page 1 of 1 (latest)
It seems like you're trying to use Incremental Static Regeneration (ISR) with on-demand revalidation. Based on the provided extracts, there are a few things you should check:
-
Make sure your upstream data provider (Strapi) does not have caching enabled by default. You might need to disable it (e.g.,
useCdn: false), otherwise, a revalidation won't be able to pull fresh data to update the ISR cache source (https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration). -
In your
getStaticPropsfunction, you should set therevalidateproperty to specify the number of seconds after which a page re-generation can occur. For example,revalidate: 10means that Next.js will attempt to re-generate the page at most once every 10 seconds source (https://nextjs.org/docs/api-reference/data-fetching/get-static-props). -
Make sure you're calling the
revalidate()function on the exact path that you want to be revalidated. For example, if you havepages/blog/**slug].jsand a rewrite from/post-1->/blog/post-1, you would need to callres.revalidate('/blog/post-1')[source** (https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration). -
Ensure that the webhook from your headless CMS is correctly set up to trigger the revalidation API when content is created or updated source (https://vercel.com/templates/next.js/nextjs-blog-preview-mode).