matteo4
December 16, 2022, 4:43pm
1
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
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?
matteo4
December 20, 2022, 3:05pm
4
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!
matteo4
December 21, 2022, 11:33am
5
Found it!
cacheTtlByStatus: { '200-299': 86400, '404': 1, '500-599': 0 }
Testing now to see if it works as expected
system
Closed
December 31, 2022, 4:44pm
6
This topic was automatically closed after 15 days. New replies are no longer allowed.