How to tell if fetch() was a cache hit or not?

When I do a fetch(), the response headers don’t contain the cf-cache-status header.

Response headers: {
  "cache-control": "max-age=60, private",
  "content-encoding": "gzip",
  "content-length": "1367",
  "content-security-policy": "frame-ancestors 'none'",
  "content-type": "application/atom+xml; type=feed; charset=utf-8",
  "dataserviceversion": "3.0",
  "date": "Tue, 01 Nov 2022 05:19:58 GMT",
  "etag": "\"9f84c70a-f446-4e72-981b-68f09e408cdd\"",
  "server": "Microsoft-IIS/10.0",
  "strict-transport-security": "max-age=31536000",
  "x-content-type-options": "nosniff",
  "x-correlationid": "8000a0ce-4003-7f00-b63f-84710c7967bb",
  "x-frame-options": "deny",
  "x-nuget-customquery": "true",
  "x-xss-protection": "1; mode=block"
}

Is there a way to verify my origin fetch request was cached?

Are you using the preview editor? You will have to use ‘wrangler dev` or deploy the Worker to see the cache status header.

Hi Albert,

I was using wrangler dev. It turns out this actually works if you deploy it fully (you can see the cache header in the wrangler tail), but it doesn’t work in dev either in local (miniflare) or in dev tunnel.

Might be useful for CF to insert a dummy header in there or something to warn that it doesn’t work in dev.