Skip to content

[release/10.0.3xx] Enable hot reloading for Blazor inside an iframe#53297

Open
github-actions[bot] wants to merge 1 commit intorelease/10.0.3xxfrom
backport/pr-51006-to-release/10.0.3xx
Open

[release/10.0.3xx] Enable hot reloading for Blazor inside an iframe#53297
github-actions[bot] wants to merge 1 commit intorelease/10.0.3xxfrom
backport/pr-51006-to-release/10.0.3xx

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Mar 6, 2026

Backport of #51006 to release/10.0.3xx

Customer Issue

Hot Reload on Blazor apps doesn't work inside iframes because BrowserRefreshMiddleware.IsBrowserDocumentRequest() only accepts requests with Sec-Fetch-Dest: document. Requests from iframes use Sec-Fetch-Dest: frame or Sec-Fetch-Dest: iframe, causing the middleware to reject them and skip script injection.

This prevents hot reload from working in scenarios like Blazing Story (Storybook clone for Blazor) and any other tooling that embeds Blazor apps within iframe contexts.

Fixes #51005

Description

Updates IsBrowserDocumentRequest to also accept "frame" and "iframe" values for the Sec-Fetch-Dest header, in addition to the existing "document" value. This allows the browser refresh middleware to inject hot reload scripts into iframe-embedded Blazor applications.

Was this a regression?

  • Yes
  • No

Testing

Updated existing tests to validate that frame/iframe requests now return true from IsBrowserDocumentRequest while other non-document values like "serviceworker" still return false. All tests in the BrowserRefresh test suite pass.

Risk

Low. The change adds two additional string comparisons to the existing Sec-Fetch-Dest validation logic without affecting any other functionality.

Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
@github-actions github-actions bot requested review from a team and tmat as code owners March 6, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants