How caching works in workers

I created a simple worker and caching doesn’t work as I expected. The endpoint loads cached value (cf-cache-status: HIT) but when I try the endpoint with another computer at home, the endpoint loads slow (not cached).

I thought since my other computer is in same timezone, it should load cached response

I send this header: "Cache-Control": "s-maxage=600", // 600 secs (10 mins)

Here is the endpoint I created https://webdata.carbonhealth.com/data.json

I got a 500 error when I tried Curl.

It’s not really time zone specific. It takes a few visits at the same datacenter before you get consistent HITs. Can you tell what the cf-cache-status is when you use the other computer? If it’s a browser, you can use Dev Tools (F12 in Chrome) in the Network tab to take a look at the response headers.

Do you have Browser Cache TTL set to Respect Existing Header?


Yes, its set to respect @adaptive

@sdayman I get 200 when I curl https://webdata.carbonhealth.com/data.json

I guess my -I wasn’t the right approach. -v gives me a proper response.

Still no cf-cache-status. I’ll leave this to to others as to how to cache a resource in Workers, as .json isn’t cached by default.