How CF cache works with cloudflare.
I am trying to figurout how exacly CF cache works with workers.
I read that workers are running in front of the cache - so my first assumption was that all request will hit worker even if they are cached but this does not seems to be true
First of all, my CF setting is to cache everything, ignore headers for 8 hours.
1. I noticed that sometimes the content is served from cache without hitting workers,
My sveltekit middleware config looks like this (screenshot).
So i have few question about that:
1. Keeping in mind my CF cache settings cache-control header will be ignored anywah here right?
2. Why sometimes I can notice two situation:
- response are directly served from cache - CPU time is 1ms
- responses are hitting worker then worker finds that data exists in cache (I see console log - cache HIT in logs) and served from cache through worker
Sometimes seems that cache is ignored completely (I see this based on CPU usage for woker - 200ms) , but 8hour of cache did not passed yet. Why is that?
My app is running in singel datacenter (Warsaw) and traffic is allowed only from Poland - based on that I would assume that within 8hours period I would traffic only served from cache. But like mention above there is three cases
- cache hit from CF
- cache hit from worker + cf
- data not served from cache even if 8hours not passed
Thanks for the help
I read that workers are running in front of the cache - so my first assumption was that all request will hit worker even if they are cached but this does not seems to be true
First of all, my CF setting is to cache everything, ignore headers for 8 hours.
1. I noticed that sometimes the content is served from cache without hitting workers,
My sveltekit middleware config looks like this (screenshot).
So i have few question about that:
1. Keeping in mind my CF cache settings cache-control header will be ignored anywah here right?
2. Why sometimes I can notice two situation:
- response are directly served from cache - CPU time is 1ms
- responses are hitting worker then worker finds that data exists in cache (I see console log - cache HIT in logs) and served from cache through worker
Sometimes seems that cache is ignored completely (I see this based on CPU usage for woker - 200ms) , but 8hour of cache did not passed yet. Why is that?
My app is running in singel datacenter (Warsaw) and traffic is allowed only from Poland - based on that I would assume that within 8hours period I would traffic only served from cache. But like mention above there is three cases
- cache hit from CF
- cache hit from worker + cf
- data not served from cache even if 8hours not passed
Thanks for the help

