Default Cache-Control max-age=60 ? #71
-
|
I just learned Next.js deafult Cache-Control for optimized images is 60 seconds (see docs)! Why would this be the default??? Why not cache for a year (or at least a longer time period than month)? Does anyone have good use case for why this should be 60 seconds? I think we should recommend in docs to increase this to larger number. Would save a lot of compute/cost since increasing cache TTL significantly decreases trips to origin from CloudFront. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
So... I was sure that this must have been a code example, not a reflection on the actual behavior... But, then I found this code, which really looks like a default value of 60 seconds for image caching.
I also found this which quotes old documentation,
More conversations related to this here... I want to clarify one point here (perhaps for future readers, this may provide helpful context). I checked the headers on my Next.js prod build for a request for an optimized image, and it had this Thanks to the etag, the browser will check with the server every 60 seconds to see if the image has changed. If it hasn’t, the server responds with This means unnecessary validation requests may happen every 60+ seconds, but actual re-downloads should be rare (only when the image changes. All that said, I still think that 60 seconds is unnecessarily short for these freshness checks. |
Beta Was this translation helpful? Give feedback.
So... I was sure that this must have been a code example, not a reflection on the actual behavior... But, then I found this code, which really looks like a default value of 60 seconds for image caching.
This seems related,
I also found this which quotes old documentation,