Closed conico974 closed 3 months ago
Latest commit: d83c12e73cc271059639a7975e9e0dc358f6d07a
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
open-next | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 1, 2024 11:24am |
At the moment, image from
_next/image
are only cached in the cdn. We don't generate anyETag
either for the image so we never get 304. Every stale request actually needs to be recomputed again.In order to improve perf and reduce cost, this PR introduces an env variable
OPENNEXT_STATIC_ETAG
that we can set on the image opt function. When you set this env variable, we create anETag
that depends on some parameter that we know before performing the image opt: ( href, width, quality, buildId ) Stale request will then return a 304 for request whereif-none-match
header is equal to the computedETag
One important things to note, when using this env variable, it means that all the images should be considered immutable (The source image should not change) and the only way to change that is to change the
BUILD_ID
(on new deploy)Not sure if this should be enabled by default or not.