Support Forums

Proxied images are not cached

Hi all!

I have a static site running on https://supera.netlify.app/. Some images are coming from a CMS dynamically. Instead of directly getting the images from the CMS, I proxy them through Netlify with the following redirect:

/assets/* https://content.pinelab.studio/assets/:splat 200

This is working fine, but it seems the images are not cached, even though the cache header is set to 30 days:

cache-control: public, max-age=2592000

I also see server: Netlify in the response headers.

This page has an example image coming from the CMS: Super A - Super A

The CMS runs on Google Cloud Run, which sometimes takes some time to spin up, resulting in a ~2 second delay before images show up.

I hoped proxying through Netlify would cache all the images. Is this a wrong assumption, or did I misconfigure something?

Thanks in advance!


I did find a detail in this answer: Proxy caching issues - #12 by Dennis

“Also, any time you trigger a deploy on your site, that also purges your site’s cache on our CDN”

Can anyone confirm that this is probably the case here, or am I missing something else?

Hi @martijnvdb,

Relying on cache for this would not be a good idea. Netlify has multiple CDN nodes in the same location and cache would be local to a specific node. So if some other CDN node handles the request, it would be passed on to the original server.

Fair point. Didn’t really think about that…

Besides that, caching for a single node does work like this, correct?

Yes, it does. A single node would cache the response from a 200 rewrite.

1 Like

Also, about this:

That’s true for static assets, not proxied content’s cache.

1 Like