It seems this problem is persisting and I am unable to fix it. I switched over from Image Resizing for a project to just Images, delivering the images from my own domain (/cdn-cgi/imagedelivery/…)
When testing with Google PageSpeed now, it complains about the cache time being just 2 days. I can confirm after checking my self I see this:
cf-images: internal=ok/- q=0 n=17+0 c=0+43 v=2023.2.1 l=4223
This is extremely annoying because my browser cache time set in Cloudflare is 1 year.
Also, this will now break my performance score as it was quite high using Image Resizing before.
How can I control the cache time for Images? This is just annoying at this point.
sorry to hear that you face this issue.
as of now only option is to use custom worker CF Images served with Custom Domain not affected by cache rules - #2 by asemiglazov
we only have global option configured to set cache-control to 2 days, nothing to override per account except using custom worker.
Thanks… but this issue persists for months. That was the reason I did not use it before and I used Image Resizing instead. I just switched over like a fool now, edited a lot of code, etc…
Not a good look. Why on earth would you set a cache time of 2 days? And why would you even release a service where you cannot specify the cache for images?
It just doesn’t make any sense. Very disappointing.
@Mecanik I will reach out privately, I think we can help.
Use a Transform Rule to set the header.
I absolutely agree with @Mecanik .
We use the Cloudflare Images Service, but have registered our domain somewhere else and therefore have no possibility to use the Transform Rule Workaround mentioned by @KianNH if I see it correctly…
And I don’t understand why the Cloudflare team is trying to solve the problem in a private chat if this problem is relevant to the general public…?
I don’t know, but if I can get a “fix” I will certainly test. What concerns me is the why. Why would you have 2 days cache TTL on the images unless you plan to update the same image URL at some point?
I have been advertising Cloudflare Images services quite a lot and got onboard a lot of people, especially businesses. However this was with Image Resizing luckily.
I’m happy to help, what’s browser cache TTL you need for your account?
The Google Lighthouse recommendation for immutable static assets is one year or longer, so that means max-age=31536000 (Serve static assets with an efficient cache policy - Chrome Developers). But the account i am using here is not the account where we use the Cloudflare Image Service for our company.
This topic was automatically closed after 15 days. New replies are no longer allowed.
now it is possible to adjust Browser TTL (cache-control) per account or variant