Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
ProTip opened this issue Jan 17, 2024 · 2 comments
Open
1 task done

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

ProTip opened this issue Jan 17, 2024 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components feature-hot-reload This issue is related to the Hot Reload feaature
Milestone

Comments

@ProTip
Copy link

ProTip commented Jan 17, 2024

Is there an existing issue for this?

  • 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<App>().AddInteractiveServerRenderMode());

});

Update App.razor <base href="/app/"/>

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

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Jan 17, 2024
@mkArtakMSFT mkArtakMSFT added the feature-hot-reload This issue is related to the Hot Reload feaature label Jan 17, 2024
@javiercn javiercn added this to the .NET 9 Planning milestone Jan 29, 2024
@ghost
Copy link

ghost commented Jan 29, 2024

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@koureasstavros
Copy link

koureasstavros commented Jan 23, 2025

Situation is the same for Blazor WebAssembly Hosted with ASP.NET.

The framework file for hot reload (aspnetcore-browser-refresh.js) does not respect UseBlazorFrameworkFiles("/app") and it is placed into the root folder instead the subpath.

In addition some NUGET packages like Blazored.Modal which are using the css isolation and are importing bundle css (Blazored.Modal.bundle.scp.css) into the main css ({ASSEMBLY_NAME}.Client.styles.css) are still placing the css into root folder (_content/Blazored.Modal/) instead on subpath (subpath/_content/Blazored.Modal/) and refference is having a relative level up. See the issue here: Blazored/Modal#593

In addition there is issue with webassembly.js but in my case I managed to solve it by calling two times the app.UseStaticFiles in Server side one time without subpath and another time with the subpath #51929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components feature-hot-reload This issue is related to the Hot Reload feaature
Projects
None yet
Development

No branches or pull requests

7 participants