Skip to content
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

Closed
styfle opened this issue Jul 15, 2021 · 1 comment · Fixed by #33735
Closed

Image Optimization should use the stale-while-revalidate pattern #27208

styfle opened this issue Jul 15, 2021 · 1 comment · Fixed by #33735
Assignees
Labels
Image (next/image) Related to Next.js Image Optimization.

Comments

@styfle
Copy link
Member

styfle commented Jul 15, 2021

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.

@styfle styfle added this to the backlog milestone Jul 15, 2021
@styfle styfle self-assigned this Jul 15, 2021
@timneutkens timneutkens modified the milestones: backlog, Iteration 23 Jul 16, 2021
@styfle styfle modified the milestones: 11.1.x, 12.0.4 Nov 5, 2021
@timneutkens timneutkens added the Image (next/image) Related to Next.js Image Optimization. label Nov 16, 2021
@timneutkens timneutkens removed this from the 12.0.5 milestone Nov 17, 2021
@kodiakhq kodiakhq bot closed this as completed in #33735 Jan 27, 2022
natew pushed a commit to natew/next.js that referenced this issue Feb 16, 2022
kodiakhq bot pushed a commit that referenced this issue Feb 17, 2022
@github-actions
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Image (next/image) Related to Next.js Image Optimization.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants