dotnet / dotnet/aspnetcore

aspnetcore-browser-refresh injection doesn't respect path prefix

Open
#53,454 3 comments 4 reactions 0 assignees View on GitHub
area-blazor feature-hot-reload
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

`aspnetcore-browser-refresh.js` Is not served on the same path prefix as supplied to `UseBlazorFrameworkFiles`.

### Expected Behavior

If I call `UseBlazorFrameworkFiles("/app")` I expect this file to be served from `/app/_framework/aspnetcore-browser-refresh.js` like the other `_framework` files.

### Steps To Reproduce

Create a stock Blazor app from template:

```
dotnet new blazor -int Server -o PathPrefix
```

Move Blazor setup in `Program.cs` into a middleware branch:

```
app.Map("/app", blazor => {
blazor.UseRouting();
blazor.UseAntiforgery();
blazor.UseStaticFiles();
blazor.UseBlazorFrameworkFiles("/app");
blazor.UseEndpoints(e => e.MapRazorComponents().AddInteractiveServerRenderMode());

});
```

Update `App.razor` ``

Load application and observe that `aspnetcore-browser-refresh.js` is not served on the supplied path prefix.

### Exceptions (if any)

_No response_

### .NET Version

8.0.1

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.