fix: allow next.config.js overwrite cache-control header#39707
fix: allow next.config.js overwrite cache-control header#39707u3u wants to merge 1 commit intovercel:canaryfrom
next.config.js overwrite cache-control header#39707Conversation
|
I would be interested in the merge of this PR too 👍 |
Hi, |
df8579c to
47e5ebe
Compare
e078ebe to
6b863fe
Compare
|
@ijjk this feature is important for everyone who uses self-hosted + Cloudflare. |
|
Any movement on this? |
|
Maintainers, please, could you review this change? |
|
@timneutkens @stefanobrambilla @ijjk @shuding @huozhi @feedthejim |
|
This is a relatively small, opt-in change with huge usability benefits; both the issue and the solution are straightforward, can this please be prioritized? |
|
This is still an issue. I would like to cache ISR pages locally, but not on the CDN. There seems to be no way to overwrite the |
|
Adding one more voice to the crowd of people affected by that issue - please review it and either provide a clear explanation on why it's undesirable - or get it merged. |
Update (2022-12-31): My Solution
Fixes #21827, fixes #22319 #28557
https://nextjs.org/docs/api-reference/next.config.js/headers#cache-control
In the documentation it is described that
Cache-Controlcannot be overridden and will affect static resources, but in fact static resources will set their ownCache-Control, so it does not seem to affect them.next.js/packages/next/server/next-server.ts
Lines 428 to 451 in 9c41634
I use
getHeader('Cache-Control')to check if the user has set their cache, which by default is the same behavior as before.By the way
hasHeaderisundefinedin some cases, I don't know why. (#34929 #37338)