Replies: 4 comments
-
It would be great if static pages can be auto served via CDN! |
Beta Was this translation helpful? Give feedback.
-
Our users are stuck forever on old versions of the app. |
Beta Was this translation helpful? Give feedback.
-
adding to that, static files from public dir have |
Beta Was this translation helpful? Give feedback.
-
Converted to a discussion as per our Triaging policy. This does not mean that the discussion got closed, feel free to discuss further! |
Beta Was this translation helpful? Give feedback.
-
Describe the feature you'd like to request
Currently pages that are automatically statically optimized (no
getServerSideProps
orgetStaticProps
orgetInitialProps
) do not have any cache-control header set when served vianext start
.This causes a slow down for all users of apps using
next start
because these static pages cannot be served from a CDN. Additionally it causes additional server load.I want these pages to be automatically cached by any CDN in front of it.
Describe the solution you'd like
I want a way to enable cache-control headers for auto static pages via next.config.js.
It could be a single flag like
Or potentially using the headers array with a special source.
And ideally we could enable it with an environment variable like
NEXT_ENABLE_STATIC_OPTIMIZATION_CACHE_CONTROL
Describe alternatives you've considered
I don't see any other alternatives besides manually configuring the CDN to cache specific pages or by using a custom server. Because the docs say "You cannot set Cache-Control headers in next.config.js"
Beta Was this translation helpful? Give feedback.
All reactions