Support a pattern like Vary for ISR (opt-out of dynamic rendering)
#58303
-
|
From the data fetching caching docs:
Over time, I ran into some cases where a route opts into dynamic rendering, disabling the Examples:
As soon as HTTP supports the Vary header to describe the headers that influence the response. I'm wondering if something like this could be supported by Next.js too. Example: // page.tsx
// Only if these headers are read via `headers().get(…)`,
// then the full route cache is skipped. Additionally, some
// headers like `host` can still support CDN caching in
// case the header is part of the cache key.
export const vary = ['authorization'];Alternatively, there could also be a list of explicitly allowed headers that don't influence the response. See also: Understanding The Vary Header |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
It's now possible to customize |
Beta Was this translation helpful? Give feedback.
-
|
My use case was for a self-hosted setup, I was able to implement this with a custom server: amannn/nextjs-request-store@e6881f3 |
Beta Was this translation helpful? Give feedback.
My use case was for a self-hosted setup, I was able to implement this with a custom server: amannn/nextjs-request-store@e6881f3