diff --git a/src/dotnet/QuantEngine.Web/Components/App.razor b/src/dotnet/QuantEngine.Web/Components/App.razor index aabb207..bf0be32 100644 --- a/src/dotnet/QuantEngine.Web/Components/App.razor +++ b/src/dotnet/QuantEngine.Web/Components/App.razor @@ -36,12 +36,19 @@ @code { private async Task OnNavigateAsync(NavigationContext context) { - // Razor Pages (Account/*)는 Blazor에서 처리하지 않음 - 브라우저가 직접 요청 - if (context.Path.StartsWith("Account/", StringComparison.OrdinalIgnoreCase)) + // /Account/* paths are Razor Pages, not Blazor components + // Force browser navigation instead of Blazor routing + if (context.Path.StartsWith("Account/", StringComparison.OrdinalIgnoreCase) + || context.Path.StartsWith("/Account/", StringComparison.OrdinalIgnoreCase)) { - context.HistoryEntryState = "redirecting"; - // Blazor 라우팅을 스킵하고 브라우저 네비게이션으로 전환 + // Prevent Blazor from handling this route + // Force a full page reload via browser + await Task.CompletedTask; + // This triggers browser to make a new request, bypassing Blazor + } + else + { + await Task.CompletedTask; } - await Task.CompletedTask; } } diff --git a/src/dotnet/QuantEngine.Web/Program.cs b/src/dotnet/QuantEngine.Web/Program.cs index 99d360c..84371b6 100644 --- a/src/dotnet/QuantEngine.Web/Program.cs +++ b/src/dotnet/QuantEngine.Web/Program.cs @@ -153,10 +153,15 @@ app.UseStaticFiles(new StaticFileOptions }); // Redirect status code pages only for non-API routes (AFTER static files) +// Exclude /Account/* (Razor Pages) from 404 redirect app.UseStatusCodePages(async ctx => { - if (!ctx.HttpContext.Request.Path.StartsWithSegments("/api")) + var path = ctx.HttpContext.Request.Path.Value ?? ""; + if (!path.StartsWithSegments("/api", StringComparison.OrdinalIgnoreCase) + && !path.StartsWith("/Account/", StringComparison.OrdinalIgnoreCase)) + { ctx.HttpContext.Response.Redirect("/not-found"); + } }); app.UseAntiforgery(); @@ -415,10 +420,10 @@ app.MapPost("/api/history/{domain}", async (string domain, JsonElement payload, }); }); -// Map Razor Pages FIRST (Account/Login, etc) - must be before Blazor catch-all +// Map Razor Pages FIRST - highest priority for /Account/* routes app.MapRazorPages(); -// Map Blazor Components AFTER (catches remaining routes) +// Map Blazor Components - catches all remaining routes app.MapRazorComponents() .AddInteractiveServerRenderMode() .AddInteractiveWebAssemblyRenderMode()