-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Image Optimization should use the stale-while-revalidate pattern #27208
Labels
Image (next/image)
Related to Next.js Image Optimization.
Comments
This was referenced Feb 2, 2022
natew
pushed a commit
to natew/next.js
that referenced
this issue
Feb 16, 2022
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the feature you'd like to request
Currently, optimized images are cached on disk for a period of time indicated by the upstream
Cache-Control
header. This means the first request to the image could be slow but subsequent requests are fast. But when the cache expires, the next request will be slow again.Describe the solution you'd like
We can avoid this second slowdown by using the stale-while-revalidate pattern. Once the cache expires, we can serve the cached image anyway and generate the new optimized image in the background.
Describe alternatives you've considered
We could apply the
stale-while-revalidate
header, but that is still experimental and doesn't work in Safari or IE. Also, Vercel strips that header so the browser will not see it.The text was updated successfully, but these errors were encountered: