question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

304 `REVALIDATED` `CF-Cache-Status` cache header

See original GitHub issue

I’m using this code

const data = await getAssetFromKV(event)
return new Response(data.body, data)

and I’m unable to use the cache. I keep getting MISS by checking the request in devtools image

I can see that it’s set to false by default https://github.com/cloudflare/kv-asset-handler/blob/f9bb072da86ec91ae8bb3b0cd06b219e26d638c2/src/index.ts#L159 and only set to true if we use ASSET_MANIFEST https://github.com/cloudflare/kv-asset-handler/blob/f9bb072da86ec91ae8bb3b0cd06b219e26d638c2/src/index.ts#L160-L167

Is this intended or I’m missing something?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
leocommented, Feb 8, 2022

Thanks for sharing!

1reaction
Cherrycommented, Oct 1, 2021

Ah I see - that makes total sense. I wasn’t replicating it because I had disable cache enabled in my dev tools. Good catch!

Since the edge cache is definitely being hit (you can see from the age header), this isn’t so much a problem, but I’ll leave this issue open for discussion about if anything should change with the 304 response.

Read more comments on GitHub >

github_iconTop Results From Across the Web

304 Status - General - Cloudflare Community
Mainly the Status 304 and the cf-cache-status:REVALIDATED. Request Method:GET Status Code:200 (from memory cache).
Read more >
When my origin serves a "304 Not Modified", Cloudflare sends ...
Basically, I'm instructing the browser here to cache the response for 5 minutes. Along with these headers I also send an etag across....
Read more >
New HTTP standards for caching on the modern web
The Cache-Status Header · Targeted Cache-Control Headers. These are designed to update HTTP standards to match the reality of the CDN-powered web that...
Read more >
Cache-Control - HTTP - MDN Web Docs
The Cache-Control HTTP header field holds directives ... The must-revalidate response directive indicates that the response can be stored in ...
Read more >
Status 200 (from disk cache) and 304 Not Modified issue
For each request I also manually add Cache-Control header res. ... must-revalidate cf-cache-status: HIT cf-ray: 618ac665c984351f-KBP ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found