In what scenarios are cache headers forced to "public, max-age=0, must-revalidate" by Vercel? #68632
Unanswered
good-idea
asked this question in
App Router
Replies: 1 comment 1 reply
-
|
You're seeing SSR-like caching headers because you're turning on draft mode for every request. I was not able to reproduce with a fresh project (seeing Are there any minimal reproductions? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Our project is using Next.js 14.2.5 + app router, deployed to Vercel.
We are trying to debug why pages on our site - the initial GET request to
/page- are all being returned with acache-control: public, max-age=0, must-revalidateresponse header. We would expect and are hoping for it to bemax-age=600 stale-while-revalidate.Running a production build locally (not using vercel) gives us the results we are expecting.
The pages all have:
And use
asyncReact components to load the data. (Some of them go on to render other components which may contain their ownasyncReact components)We have explicitly set
cache: 'force-cache'on all requests made to generate the page. Some of these are GET, some are POST. These requests are given tags.The response includes a
x-vercel-cache: HITheading - does this refer to the CDN cache or the Next.js data cache?We are using middleware for localized routing (i.e.
/some-page,/en-US/some-page)We have a check for
draftMode().isEnabledon every request - but we tried disabling this and doing so had no effect.The documentation is not clear on when the
dynamic = 'force-static'setting will be overridden. I understand that making a fetch request withcache: 'no-store', reading cookies, or reading headers will force a page to be dynamic - but we are not doing any of this.We see that a fresh project created by
create-next-appand deployed to vercel is showing the same behavior.What else could be happening that would be overriding
force-static?Beta Was this translation helpful? Give feedback.
All reactions