Repository navigation
Description
Summary
When running a Blazor WebAssembly app with Hot Reload behind an Aspire DevTunnel (devtunnels.ms origin), the browser blocks the HotReload runtime module loaded from due to missing CORS headers. This prevents the dynamic import of and breaks Hot Reload / app startup.
Environment
• Project type: Blazor WebAssembly (ASP.NET Core hosted) with Hot Reload enabled
• Tunnel provider: Aspire DevTunnel (domain pattern )
• Local dev server: (Kestrel / ASP.NET Core dev server)
• Browser: Chromium-based (error shown in console)
• Observed on: local development machine using dev tunnel to expose local site
Steps to reproduce
- Start the ASP.NET Core backend and Blazor WebAssembly app locally (listening on ) with Hot Reload enabled.
- Expose the local site through Aspire DevTunnel so the public origin is something like .
- Open the tunneled URL in a browser.
- Observe console errors and failed module load.
Actual behavior
Browser console shows CORS error and module load failure:
Hot Reload module is requested from while the page origin is the devtunnel domain, so the browser blocks the request because the response lacks .
Expected behavior
The Hot Reload module should load successfully when the app is accessed via the dev tunnel. Either:
• The dev server should respond with the appropriate CORS headers allowing the devtunnel origin, or
• The dev tunnel should proxy requests so the browser sees same-origin responses, or
• The Hot Reload client should request the module from the tunneled origin rather than .
Temporary workarounds
• Access the site directly via (no tunnel) to avoid cross-origin requests.
• Manually enable permissive CORS on the local dev server during development (e.g., allow or ) — note: only for local dev, not production.
• Disable Hot Reload if that avoids the dynamic import (loses Hot Reload functionality).
Suggested fixes / investigation pointers
• Ensure the dev server (Kestrel / ASP.NET Core) includes for requests coming from the devtunnel origin. This can be done by configuring CORS middleware to allow the tunnel origin(s) during development.
• Alternatively, have the dev tunnel proxy the Hot Reload static content so the browser requests the module from the same tunneled origin instead of .
• Investigate why the Hot Reload client resolves the module URL to when the page origin is the devtunnel domain; consider making the Hot Reload client use relative or tunneled URLs when behind a proxy/tunnel.
• Consider adding guidance to documentation for using Hot Reload with dev tunnels (example CORS config or recommended tunnel proxy settings).
Additional information
• This appears specific to dynamic module imports used by the Hot Reload runtime and how the runtime constructs the module URL.
• Reproducible consistently when using Aspire DevTunnel (tunneled origin differs from ).
• Console stack traces and network request details are attached above; I can provide a HAR or screenshots if helpful.
Activity
davidfowl commentedon Feb 26, 2026
cc Daniel Roth (@danroth27) Larry Ewing (@lewing) Javier Calvarro Nelson (@javiercn)
danroth27 commentedon Feb 26, 2026
Aspire + Blazor WebAssembly hot reload issue. Adding Devin Breshears (@dbreshears) Sayed Ibrahim Hashimi (@sayedihashimi).
mahdiyar021 commentedon Apr 28, 2026
Any update ?
DamianEdwards commentedon Oct 20, 2026
mahdiyar (@mahdiyar021) could you share a few details to help us narrow this down? Several URLs and module names appear to be missing from the issue description.
dotnet --info), and the Blazor app’s target framework.aspire run, ordotnet watch.We found that some hot-reload tooling connects directly to
localhostrather than through the tunnel, while newer tooling can reject the tunnel’s WebSocket origin. The exact failed request will help distinguish those cases from the dynamic-module CORS failure you’re seeing.mahdiyar021 commentedon Oct 20, 2026
Just create an Aspire app with Blazor and ASP.NET. It won't work with DevTunnel; I tested it 3 or 4 months ago. My PC is broken right now, so I can't help with this at the moment.
DamianEdwards commentedon Oct 20, 2026
We reproduced a Dev Tunnel hot-reload failure with .NET SDK 10.0.402 and verified that the same hosted Blazor WebAssembly scenario works through a live Dev Tunnel with .NET 11 RC2 (SDK 11.0.100-rc.2.26504.105), without additional origin configuration. The app can remain targeted at net10.0.
.NET 11 RC2 includes the SDK fix in dotnet/sdk#56118 (backported in dotnet/sdk#56362), which routes hot-reload traffic through the application origin instead of connecting directly to localhost. No Aspire code change was needed in our repro.
The failure we confirmed on .NET 10 was a rejected hot-reload WebSocket connection rather than the exact module-import CORS error described here, but the newer SDK resolves the tunnel scenario we tested. Please try it with .NET 11 RC2 when you are able.
mahdiyar021 commentedon Oct 21, 2026
Any fix for dotnet 10 ?
DamianEdwards commentedon Oct 21, 2026
mahdiyar (@mahdiyar021) not sure, that's a question for the .NET SDK & Blazor folks, but looking at it it's a pretty big change so not sure if it meets the typical servicing bar.