CF Images served with Custom Domain not affected by cache rules

Hi!

Following @asemiglazov 's advice in this thread, I added a Cache Rule to make the images be cached longer on the CDN, but it seems this does not have any effect whatsoever in changing the cache-control.

In the linked thread, the OP didn’t have any success with this method either, but didn’t receive any follow-up.

What is the proper way to get a longer cache than 2 days?

Cheers,
Daniel

Hi, sorry for late response, I just checked and apparently page rules that affect cache-control don’t work with /cdn-cgi/imagedelivery/* path.

And it seems the only way currently is to use custom worker to override response headers.

Gotcha! That’s not really ideal. Is this something that will be added to options for CF Images?

It is something that can be done in theory. We first need to assess what and when it can be added.

1 Like

I’m running into the exact same problem; we would like Cloudflare Images to have a long cache-duration, this is currently the only check keeping us from a perfect score in Google Lighthouse.

It would make sense if the cache-duration would be a setting within Cloudflare Images, but a rule (cache rule or header modification rule) would work too.

1 Like

This topic was automatically closed after 15 days. New replies are no longer allowed.