wrangler published static files is not atomic?

By not atomic, I mean sometimes the index.html has already updated, but the lastest js file that the index.html referenced doesn't.

In this case, cloudflare will fallback to return the index.html even we are requesting a .js file

What worse, cloudflare will cache the fallback wrong content, because the path ends with .js (cacheable).

so customers can't access our site until the cache expires.


some context:
  1. I'm using github actions for npm build, then use wranglish publish to upload dist directly to pages
  2. That's a SPA web, filename contains hash (eg. /js/app.1a2b3c4d.js)
  3. all cache settings default, and Tiered Cache disabled
Some possible workaround:
  1. disable cache if Sec-Fetch-Des doesnt match the fallback content-type
  2. disable cache for all fallback
  3. disable cache for .js fallback (or just dont fallback .js)
Was this page helpful?