Skip to content

[Blazor WebAssembly] Recover from cached HTTP errors and invalid boot resource responses #135090

Open

Description

@oroztocil

Originally reported in dotnet/aspnetcore#69488.

Describe the bug

Fingerprinted boot resources use cache: "force-cache". A cached HTTP error or invalid response can keep failing integrity checks after the server recovers, without another network request. Integrity rejection does not necessarily evict the HTTP-cache entry.

Real-browser probes reproduced persistent 404/500/503 responses in Chrome 154 and Playwright Firefox 155, independently of the dev server's empty-200 bug. WebKit required additional caching metadata in the tested cases. Shipping Safari and a complete production Blazor outage were not verified.

Expected Behavior

Attempt bounded recovery with cache: "reload", preserving integrity, credentials, and healthy cached startup performance. Fail normally if recovery fails. Recovery must work when Blazor disables general download retries (enableDownloadRetry: false) and preserve custom response-loader behavior.

Steps To Reproduce

See the parent issue for the Blazor repro. At the browser boundary:

  1. Fetch a resource returning 404 using force-cache and the expected valid content's integrity hash.
  2. Restore valid content at the same URL.
  3. Repeat the fetch and reload the page. Chrome/Firefox continue failing without another asset request.
  4. Fetch with cache: "reload" and the same integrity hash. Subsequent loads recover.

Exceptions (if any)

Integrity mismatch followed by TypeError: Failed to fetch and boot failure.

.NET Version

Reported on 10.0.12. Equivalent cache logic remains in release/11.0, but an equivalent full Blazor reproduction is still needed. Testing dotnet.js is not equivalent to testing an assembly: it uses import().

Anything else?

Implementation belongs in dotnet/runtime, primarily src/mono/browser/runtime/loader/assets.ts. Server-side prevention alone cannot repair existing cached responses or cover other hosts.

Workarounds after server repair: enable DevTools Network > Disable cache and reload, clear only the HTTP cache, or refresh affected URLs with cache: "reload".

Activity

  1. added theissue type on Oct 2, 2026
  2. transferred this issue fromdotnet/aspnetcoreon Oct 2, 2026
  3. added
    untriaged
    on Oct 2, 2026
  4. added
    os-browser
    arch-wasm
    and removed
    untriaged
    on Oct 2, 2026
  5. dotnet-policy-service commented on Oct 2, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
    See info in area-owners.md if you want to be subscribed.

  6. added this to the Future milestone on Oct 2, 2026
  7. MihuBot commented on Oct 2, 2026

    @MihuBot

    I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):

  8. dotnet-policy-service commented on Oct 2, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/runtime-infrastructure
    See info in area-owners.md if you want to be subscribed.

  9. modified the milestones: Future, 12.0.0 on Nov 2, 2026
  10. LostBeard commented on Nov 23, 2026

    @LostBeard

    Adding a real-world production occurrence, since knowing the scope helps prioritize this.

    What happened (2026-11-21, Chrome, .NET 10 Blazor WebAssembly on GitHub Pages): our app AssistZ stopped booting for a user with
    download '.../_framework/System.Reflection.Emit.Lightweight.<fingerprint>.wasm' ... failed 0 TypeError: Failed to fetch (integrity failure).
    Every one of the 63 boot resources on the server matched its sha256 in the boot config. The browser's HTTP cache held a 54,887-byte GitHub Pages 503 error page for that one URL, cached during a transient GitHub Pages outage.

    • fetch(url, {cache: 'force-cache'}) returned the cached 503; fetch(url, {cache: 'no-store'}) returned the correct 200.
    • Hard reload did not recover (tried many times): the loader passes an explicit cache: 'force-cache', so the reload's cache bypass does not apply to these fetches.
    • The loader's retry (enableDownloadRetry) re-issues the same request with the same force-cache mode, so both retries get the same cached 503.
    • The only recovery was manual: fetch(url, {cache: 'reload'}) in devtools to overwrite the entry. A normal visitor stays stuck until the browser evicts the entry.

    Why the scope is large for GitHub Pages users: a user/org GitHub Pages site serves every repository from one origin (<user>.github.io). We have 64 Pages sites on that origin, nearly all Blazor WebAssembly apps and library demos. "Clear site data" is therefore not a safe workaround to give users: it wipes the storage (IndexedDB, OPFS, caches) of every app on the origin. Any transient 5xx/404 from the host during a deploy or outage can permanently brick a Blazor app for the affected visitors, with no user-side recovery short of devtools.

    We agree with the proposed fix (bounded retry with cache: "reload", preserving integrity), and it is needed sooner than .NET 12 if possible: a servicing fix for .NET 10 would make a real difference.
    Until then we are shipping a temporary, reusable workaround as a Blazor JS initializer (beforeWebAssemblyStart -> loadBootResource that retries a failed or integrity-rejected boot resource once with cache: "reload"). I will link it here once it is published.

  11. LostBeard commented on Nov 23, 2026

    @LostBeard

    Follow-up: the temporary workaround is published, for anyone else hitting this before a runtime fix ships.

    • Package: SpawnDev.Blazor.BootRecovery (net10.0), source: https://github.com/LostBeard/SpawnDev.Blazor.BootRecovery
    • It is a single Blazor JS initializer: a fetch sent with cache: "force-cache" that fails (integrity rejection or non-2xx) is retried once with cache: "reload", keeping integrity and all other options. Successful cached responses are returned untouched. No app code changes.
    • Tests run a published app in real Chromium (real HTTP cache, no request interception) against a server that answers one boot file with a cacheable 503/404, for both an assembly and dotnet.native.wasm. Without the workaround the app stays broken after the server recovers and never requests the file again (the bug, reproduced on every run); with it, the app boots on the first reload with one re-fetch, and the next load is a plain cache hit.

    It is tracked for removal once this issue is fixed: LostBeard/SpawnDev.Blazor.BootRecovery#1. If a runtime-side fix lands, the same test harness (-p:BootRecovery=false) can confirm it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmarea-Infrastructureinvestigateos-browser

Type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions