-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
In attempting to upgrade my .net projects to .net 8, I've run in to a breaking issue with app.UsePathBase(). In .net 6 and .net 7, specifying app.UsePathBase("Path"); would change your url from https://www.somesite.com/ to https://www.somesite.com/Path. The use of this is important when hosting a number of seperate websites on the same domain behind a reverse proxy. Ref: https://www.geeksforgeeks.org/components-of-a-url/
Expected Behavior
After specifying:
string NewPath = "/blazor";
app.UsePathBase(NewPath);
My expectation is that the website, including when running locally, would appear as http/s/:domain/NewPath.
Steps To Reproduce
Using Visual Studio Community 2022 version 17.8.5, dotnet sdk 8.0.101 :
- Create a new project
-
- Blazor Web App
-
- framework: .net 8.0 long term support
-
- Authentication type: none
-
- Configure HTTPS: true
-
- Interactive render mode: server
-
- Interactivity location: Global
-
- Include sample pages: true
-
- do not use top-level statements: true
Code changes:
- do not use top-level statements: true
- program.cs - replace lines 25-27 with:
app.UsePathBase("/blazor/");
app.UseStaticFiles();
app.UseHttpsRedirection();
app.UseRouting(); - App.razor - replace line 7 with:
Run the project using https.
Exceptions (if any)
No response
.NET Version
8.0.101
Anything else?
`dotnet --info
.NET SDK:
Version: 8.0.101
Commit: 6eceda187b
Workload version: 8.0.100-manifests.df7c29bf
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.101\
.NET workloads installed:
Workload version: 8.0.100-manifests.df7c29bf
There are no installed workloads to display.
Host:
Version: 8.0.1
Architecture: x64
Commit: bf5e279d92
.NET SDKs installed:
8.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 7.0.15 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download`