Does anyone know why file hashes are
Does anyone know why file hashes are different for different requests? It seems like different clients get different builds. For example, visiting this page
https://v2.talkdash.orth.uk/sw.js
and hard refreshing (command shift R) will often, but not always give different generated strings.
I'm working on a PWA, browsers will think there's a PWA update, and updates the service worker and my app prompts the user (bug will immediately be visible on https://v2.talkdash.orth.uk/)
I have turned off cloudflare web analytics and redeployed to make sure it's not beacon.js causing issues6 Replies
Oh weird, its happening way more frequently for firefox:
It still happens on chrome, but much less frequently (left chrome, right firefox)
I noticed they were cycling back and forth through a limited selection, it wasn't just random
Weirdly, this has stopped happening now 🤔. No changes from my side
Might be related to deployment, where CF pages doesn't always serve the latest build
You have cache on that file
that's pretty typical cache behavior, if you're hitting cloudflare location which is called a MCP (multi-colo point of presence), its a location/city which is served via mutiple cloudflare datacenters/colos. Each colo has its own cache, and when your connection dies you get routed randomly.
(so one has one version in cache, another has another, etc. Some browsers end the connection when you hard refresh)
You shouldn't have Cache in front of pages at all though (Cloudflare unfortunely has it on for default for specific asset types). Pages has its own internal cache, not reflected by the headers. You can make a simple cache rule to disable it, ex:
You can find cache rules under Cache -> Cache Rules
Oh wow, lovely, thanks. I'll give that a go. Great idea to check the response headers, didn't think of that 🥹
Lovely, it's working now, thanks