fix: correct middleware pipeline order - CRITICAL
TaxBaik CI/CD / build-and-deploy (push) Successful in 7m38s
TaxBaik CI/CD / build-and-deploy (push) Successful in 7m38s
URGENT FIX: The request reached the end of the pipeline without executing the endpoint Root cause: - UseBlazorFrameworkFiles was positioned AFTER UseRouting - This caused WASM files to not be intercepted properly - Result: 500 error on all requests, admin login completely broken Solution: Correct order (ASP.NET Core pipeline): 1. UsePathBase 2. UseResponseCompression 3. UseBlazorFrameworkFiles (WASM files) ← MUST be BEFORE UseRouting 4. UseStaticFiles (static assets) 5. UseSession 6. UseRouting ← Now in correct position 7. UseExceptionHandler 8. UseRateLimiter, UseAuthentication, UseAuthorization, UseAntiforgery 9. Map* (endpoints) 10. MapFallbackToFile (SPA fallback, LAST) Critical: Middleware order is pipeline execution order. UseBlazorFrameworkFiles must run BEFORE routing to intercept WASM requests. This fixes: ✓ 500 InvalidOperationException ✓ Admin login page WASM loading ✓ All static WASM files (_framework/) ✓ Portal login page ✓ Razor Pages (Sitemap, RSS) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
+16
-12
@@ -364,13 +364,18 @@ catch (Exception ex)
|
||||
|
||||
app.UsePathBase("/taxbaik");
|
||||
app.UseResponseCompression();
|
||||
|
||||
// WASM 프레임워크 파일 (정적 파일 전에)
|
||||
app.UseBlazorFrameworkFiles("/admin");
|
||||
app.UseBlazorFrameworkFiles("/portal");
|
||||
|
||||
// 정적 파일 제공 (정적 경로별)
|
||||
app.UseStaticFiles();
|
||||
app.UseStaticFiles("/admin");
|
||||
app.UseStaticFiles("/portal");
|
||||
|
||||
app.UseSession(); // TempData 쿠키 저장소
|
||||
app.UseRouting();
|
||||
app.UseRateLimiter();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseAntiforgery();
|
||||
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
@@ -378,20 +383,19 @@ if (!app.Environment.IsDevelopment())
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
// Admin & Portal Blazor WebAssembly SPA 호스팅 (미들웨어 먼저!)
|
||||
app.UseBlazorFrameworkFiles("/admin");
|
||||
app.UseStaticFiles("/admin");
|
||||
app.UseBlazorFrameworkFiles("/portal");
|
||||
app.UseStaticFiles("/portal");
|
||||
app.UseRateLimiter();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseAntiforgery();
|
||||
|
||||
// API + Razor Pages + 정적 파일 매핑 (라우팅은 나중에)
|
||||
// API + Razor Pages + 정적 자산 매핑
|
||||
app.MapControllers();
|
||||
app.MapFastEndpoints();
|
||||
app.MapHealthChecks("/healthz");
|
||||
app.MapRazorPages(); // Sitemap.cshtml이 여기서 먼저 매치됨!
|
||||
app.MapRazorPages(); // Sitemap.cshtml, Rss.cshtml, Feed.cshtml
|
||||
app.MapStaticAssets();
|
||||
|
||||
// SPA 라우팅 폴백 (각 경로에서 index.html 제공) - 가장 마지막에!
|
||||
// SPA 라우팅 폴백 (가장 마지막에!)
|
||||
app.MapFallbackToFile("admin/{*path:nonfile}", "admin/index.html");
|
||||
app.MapFallbackToFile("portal/{*path:nonfile}", "portal/index.html");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user