💸 Raise image minimumCacheTTL so optimised images stay cached - #4918
Draft
isaaclombardssw wants to merge 1 commit into
Draft
💸 Raise image minimumCacheTTL so optimised images stay cached#4918isaaclombardssw wants to merge 1 commit into
isaaclombardssw wants to merge 1 commit into
Conversation
next.config.mjs set images.minimumCacheTTL to 60s, so every /_next/image response was near-uncacheable and re-optimised constantly. Raise it to a year (31536000). Image URLs are keyed on source path + width + quality, so a content change in Tina produces a new upload path and a new URL — a long TTL is safe. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q8genJyZboXaa4vgYhJF4P
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4902
next.config.mjssetimages.minimumCacheTTL: 60, so every/_next/imageresponse carried a 60-second cache lifetime — repeat visitors and multi-page sessions re-downloaded (and the server re-optimised) every image. This is Lighthouse's "Use efficient cache lifetimes" finding.Raised it to a year (
31536000), the usual choice. Optimised image URLs are keyed on source path + width + quality, so changing an image in Tina produces a new upload path and therefore a new URL — the long TTL is safe and doesn't require a manual purge.One-line change; the rest of the
imagesblock is untouched to avoid conflicts with the other open PRs on this file.Note: the acceptance criteria also ask to confirm the CDN/host in front of the app isn't overriding the
Cache-Controlheader and to re-run Lighthouse — those verifications need a deploy and should be checked on the preview/staging slot.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q8genJyZboXaa4vgYhJF4P