Hi there!
I have a question regarding the Cache-Control policy, for now, it seems that Netlify sends public,max-age=0,must-revalidate to completely ignore any browser cache.
How can I change this behaviour? I have my images immutable by URL so I’d like to set it to public, max-age=31536000, immutable
I think that the main problem is that looks like Images CDN is running on Netlify’s internal functions, but there is a limitation in the document which you’ve provided:
Custom headers apply only to files Netlify serves from our backing store. If you are proxying content to your site or dealing with a URL handled by a function or edge function such as a server-side rendered (SSR) page, custom headers won’t be applied to that content
The headers should be applied on the original image path and not on the /.netlify/images path. The orignal image’s headers should be applied to the ones served by the Image CDN as well. Could you try that please?
As you can see, the Netlify Image CDN response is not passing on the cache-control headers from the source image. Also, when I load these images in a browser and look at the network tab in the console (with “disable cache” unchecked), I see that Netlify returns a 200 every time, instead of a 304 as I’d expect, so something doesn’t seem to be quite right from a caching point of view.
This happens regardless of what cache-control headers I set on the source images. Is this a bug or am I doing something wrong?
Im also following this. Using Astro no images are caching I have tried _headers in my netlify.toml in my Astro.requests dynamic pages to control but nothing works.
@hrishikesh any news on this? I’m having the same issue, remote end returns cache-control: max-age=31536000 header but Netlify Image CDN always returns cache-control: public,max-age=0,must-revalidate
Not specifically about cache-control headers, but we now respond with etag, so the browser should be able to use that to store and validate local cache.