CF is not caching IPFS resized images

Good day!
Our domain kabooom-media.io is using Cloudflare to resize a lot of images that come from IPFS and, considering that IPFS is not a domain in our zone, we’ve also set up a worker following this page to cache using fetch:
https://developers.cloudflare.com/workers/examples/cache-using-fetch/

The worker route is set to kabooom-media.io/* but Cloudflare is still not caching them at all. In fact if you check this example:

https://kabooom-media.io/cdn-cgi/image/width=250,quality=75/https://ipfs.io/ipfs/QmYojCWFGuJraZvsVsFnHrEez47bbUaraXJqPAcqB7iRSk

you’ll see that the headers are “cf-cache-status: DYNAMIC” and “cache-control: public, max-age=29030400, immutable”.

It seems the worker is not doing its job or it’s not being called at all.
How do we cache properly these images?

Thank you to anyone that can answer, techincal support by Cloudflare is completely absent :slight_smile:

Do you have a support ticket open with us, would you mind sharing the number?

curl -svo /dev/null/ "https://kabooom-media.io/cdn-cgi/image/width=250,quality=75/https://ipfs.io/ipfs/QmYojCWFGuJraZvsVsFnHrEez47bbUaraXJqPAcqB7iRSk" 2>&1 | grep 'cf-cache-status'

< cf-cache-status: HIT

did you try to set cacheEverything: true and it doesn’t work?

Hi @SeanEustace and @asemiglazov , it seems that after around 24 hours the worker started getting requests and the caching process started correctly.

Looks like a very good solution, but it seems it is currently caching also error responses.

What’s the field in the worker that we can use to filter by response error (we don’t want to cache any 422 error)?

Thanks!

Found it!

cacheTtlByStatus: { '200-299': 86400, '404': 1, '500-599': 0 }

Testing now to see if it works as expected

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