How to invalidate cache of the homepage of a Next.js site?
Answered
Muscovy Duck posted this in #help-forum
Muscovy DuckOP
I just migrated an old website to a Next.js 13.4.19 site.
I am surprised to see many 404 in my logs and suspect that the homepage is cached in many users browsers.
Is there a way to set cache to
I am surprised to see many 404 in my logs and suspect that the homepage is cached in many users browsers.
Is there a way to set cache to
Cache-Control: no-cache, no-store, max-age=0, must-revalidate for only the / route? (app folder)7 Replies
Muscovy DuckOP
@Muscovy Duck I just migrated an old website to a Next.js 13.4.19 site.
I am surprised to see many 404 in my logs and suspect that the homepage is cached in many users browsers.
Is there a way to set cache to `Cache-Control: no-cache, no-store, max-age=0, must-revalidate` for only the `/` route? (app folder)
export const dynamic = 'force-dynamic' on your /app/page.jsxAnswer
Muscovy DuckOP
Ohh nice, seems to be doing the trick, thanks a lot!
Muscovy DuckOP
There is a bug issue with this with next-sitemap: it emptied my sitemap-0.xml I have no idea why.
If I remove the
If I remove the
export const dynamic = 'force-dynamic' line from layout.tsx page, I have the js error in Search Console errorsAny idea how to solve this?
@Muscovy Duck There is a bug issue with this with next-sitemap: it emptied my sitemap-0.xml I have no idea why.
If I remove the `export const dynamic = 'force-dynamic'` line from `layout.tsx` page, I have the js error in Search Console errors
Hi, please create a new thread as its a different problem
Thanks