-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache-Control is not appended to Dynamic Routing in Next.js 14.2.12 #70213
Comments
We stumbled upon this very same issue, very glad we spotted it in our staging environment. This may indeed be problematic. We had to modify our Cloudflare Edge cache TTL behavior to "Use cache-control header if present, bypass cache if not" as a workaround |
I encountered the same issue. After inspecting what happened, I think the issue is caused by removing the fallback value. The |
This removes an inaccurate check that doesn't set a revalidate value if revalidate is `undefined` which can be the case for SSR app route pages. Also adds a regression test to ensure this doesn't break again. Fixes: #70213 # Conflicts: # packages/next/src/server/base-server.ts
Hi, this has been fixed in |
Thank you!! |
Link to the code that reproduces this issue
https://github.com/yuta-hayashi/next-cache-control-test
To Reproduce
I am using Next.js AppRouter.
After upgrading to Next.js 14.2.12, the Cache-Control header is no longer given in Dynamic Routes.
In version 14.2.9,
Cache-Control: private, no-cache, no-store, max-age=0
was given.I am self-hosting Next.js and using a CDN, so this change is very significant.
CDNs like Cloudfront will apply the default cache settings if the Cache-Control header is not given.
This can lead to serious accidents if dynamic pages are cached.
Current vs. Expected behavior
Complete code repository: https://github.com/yuta-hayashi/next-cache-control-test
I tested it with a simple Dynamic Page as follows
dynamic/page.tsx
next 14.2.12
Dynamic pages have no Cache-Control.
Is it correct??
next 14.2.9
I expect this behavior in Next.14.2.12 as well.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 Available memory (MB): 65536 Available CPU cores: 10 Binaries: Node: 18.17.1 npm: 9.6.7 Yarn: N/A pnpm: 9.5.0 Relevant Packages: next: 14.2.12 // Latest available version is detected (14.2.12). eslint-config-next: 14.2.12 react: 18.3.1 react-dom: 18.3.1 typescript: 5.6.2 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
next start (local), Other (Deployed)
Additional context
https://nextjs.org/docs/app/building-your-application/deploying#automatic-caching
I believe this behavior in v14.2.12 is different from what the documentation says.
This may have changed in v14.2.10 because of changes related to Cache-Control.
https://github.com/vercel/next.js/releases/tag/v14.2.10
The text was updated successfully, but these errors were encountered: