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 Optimizer - upstream max-age regression #35987

Closed
1 task done
lluzak opened this issue Apr 8, 2022 · 4 comments · Fixed by #37625
Closed
1 task done

Image Optimizer - upstream max-age regression #35987

lluzak opened this issue Apr 8, 2022 · 4 comments · Fixed by #37625
Assignees
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization.

Comments

@lluzak
Copy link

lluzak commented Apr 8, 2022

Verify canary release

  • I verified that the issue exists in Next.js canary release

Provide environment information

Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000
Binaries:
Node: 14.19.0
npm: 6.14.16
Yarn: 1.22.17
pnpm: N/A
Relevant packages:
next: 12.1.4
react: 17.0.2
react-dom: 17.0.2

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Changes done for upstream max-age value done in 2373320, are no longer there.

Once again for upstream images we use max-age 0 which breaks CDN caching.

: `public, max-age=0, must-revalidate`

Expected Behavior

Bring back changes from 2373320.

To Reproduce

Serve image from upstream server and Cache-Control header will have max-age equals 0.

@lluzak lluzak added the bug Issue was opened via the bug report template. label Apr 8, 2022
@anitzterritory

This comment was marked as off-topic.

@maltesa

This comment was marked as off-topic.

@balazsorban44 balazsorban44 added the Image (next/image) Related to Next.js Image Optimization. label Apr 29, 2022
@pbright
Copy link

pbright commented Jun 6, 2022

There is some discussion of this issue on #35596.

@styfle styfle self-assigned this Jun 10, 2022
@kodiakhq kodiakhq bot closed this as completed in #37625 Jun 13, 2022
kodiakhq bot pushed a commit that referenced this issue Jun 13, 2022
…37625)

In a previous PR (#34075), the ISR behavior was introduced to the Image Optimization API, however it changed the cache-control header to always set maxage=0. While this is probably the right behavior (the client shouldn't cache the image), it introduced a regression for users who have CDNs in front of a single Next.js instance (as opposed to [multiple Next.js instances](https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration#self-hosting-isr)).

Furthermore, the pros of client-side caching outweight the cons because its easy to change the image url (add querystring param for example) to invalidate the cache.

This PR reverts the cache-control behavior until we can come up with a better long-term solution.

- Fixes #35987
- Related to #19914 
- Related to #22319 
- Closes #35596
@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 Jul 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. Image (next/image) Related to Next.js Image Optimization.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants