You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have setup YARP for the Blazor project but it doesn't properly work. For resources (bootstrap.min.css, app.css) located in the www folder (of the Blazor app) the YARP proxy forwards them to the legacy webforms app although they exist in the Blazor app.
To Reproduce
Here's the program file:
varbuilder= WebApplication.CreateBuilder(args);// Add services to the container.
builder.Services.AddRazorComponents().AddInteractiveServerComponents();// web adapters/setup YARP
builder.Services.AddSystemWebAdapters();
builder.Services.AddHttpForwarder();varapp= builder.Build();// Configure the HTTP request pipeline.if(!app.Environment.IsDevelopment()){
app.UseExceptionHandler("/Error", createScopeForErrors:true);// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();
app.UseSystemWebAdapters();// endpoints
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();// yarp
app.MapForwarder("/{**catch-all}", app.Configuration["ProxyTo"]).Add(static builder =>((RouteEndpointBuilder)builder).Order =int.MaxValue);
app.Run();
htmlsplash
changed the title
YARP Reverse Proxy not working correctly with Blazor SSR template in .net8
YARP Reverse Proxy not working correctly with Blazor SSR Project in .net8
Feb 6, 2024
@MihaZupan
That solved the issue, thank you.
This is a difficult thing to spot especially since UseRouting middleware is not added by Blazor template. This should be somewhere in the docs. Many people will run into the same problem.
Describe the bug
We have 2 projects in our solution:
We have setup YARP for the Blazor project but it doesn't properly work. For resources (bootstrap.min.css, app.css) located in the www folder (of the Blazor app) the YARP proxy forwards them to the legacy webforms app although they exist in the Blazor app.
To Reproduce
Here's the program file:
appsettings.json (omitted logging info)
"AllowedHosts": "*", "ProxyTo": "http://localhost:60675/"
Further technical details
The webforms runs on .net framework 4.8
The Blazor server app (SSR) runs on .net 8
Testing is done on Windows 10
The text was updated successfully, but these errors were encountered: