Skip to content

[Blazor] Compute relative root in preloading paths #62225

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

maraf
Copy link
Member

@maraf maraf commented Jun 3, 2025

We are using relative paths in preloading headers. For routes containing several segments, like /path/to/page, we need to make preloading paths relative to the root, as ../../_framework/dotnet.js. The reason why absolute paths might be is that the whole blazor app can be nested in some subpath.

  • Blazor hosted in root /
    • @page "/counter"
      • url in browser /counter
      • preloading path _framework/dotnet.js
    • @page "/folder/path"
      • url in browser /folder/path
      • preloading path ../_framework/dotnet.js
    • @page "/folder1/folder2/path"
      • url in browser /folder1/folder2/path
      • preloading path ../../_framework/dotnet.js
  • Blazor hosted on /subpath
    • @page "/counter"
      • url in browser /subpath/counter
      • preloading path _framework/dotnet.js
    • @page "/folder/path"
      • url in browser /subpath/folder/path
      • preloading path ../_framework/dotnet.js
    • @page "/folder1/folder2/path"
      • url in browser /subpath/folder1/folder2/path
      • preloading path ../../_framework/dotnet.js

A problematic bit is if user adds a trailing slash to the URL, like /counter/

Fixes #62174

@maraf maraf added this to the 10.0-preview6 milestone Jun 3, 2025
@maraf maraf self-assigned this Jun 3, 2025
@maraf maraf added the area-blazor Includes: Blazor, Razor Components label Jun 3, 2025
@maraf maraf changed the title [Blazor] Root preload URLs [Blazor] Compute relative root in preloading paths Jun 5, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[blazor][wasm] preload links are not properly rooted for app start from deep link
1 participant