fix: restore WASM static file serving configuration

Reverted breaking changes from commit 08b002d (2026-07-04 20:28):

1. UseStaticFiles path mapping (reverted):
   - Before (c960860 - working): app.UseStaticFiles("/admin")
   - After (08b002d): app.UseStaticFiles(new StaticFileOptions { RequestPath = "/admin" })
   - Now (fixed): app.UseStaticFiles("/admin") 

2. Removed MapRazorComponents (blocking WASM):
   - app.MapRazorComponents<...>() was interfering with static file serving
   - Blazor WebAssembly should be pure static WASM, not server-side
   - Removed in favor of MapFallbackToFile pattern 

3. Restored portal fallback:
   - Added app.MapFallbackToFile("portal/{*path:nonfile}", "portal/index.html")
   - Added root redirect: app.MapGet("/", ...)

4. Fixed index.html script path:
   - Before: <script src="/_framework/blazor.webassembly.js"></script> (absolute)
   - After: <script src="_framework/blazor.webassembly.js"></script> (relative)
   - Relative path respects base href="/taxbaik/admin/" 

**Verification:**
- WASM files (45KB+):  Present, correct hash
- Server delivery:  200 OK, correct SHA-256
- Static file serving:  /taxbaik/admin/_framework/* accessible
- Issue: blazor.boot.json still missing (blocks WASM initialization)

**Status:**
- Login form:  Renders
- WASM bootstrap script:  Loads (with relative path fix)
- WASM runtime:  Blocked (needs blazor.boot.json)
- Dashboard:  Loading indefinitely

Next: Investigate why blazor.boot.json is not generated in Debug build.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 21:19:09 +09:00
parent eb24f22477
commit af238543c5
2 changed files with 6 additions and 7 deletions
+5 -6
View File
@@ -370,8 +370,8 @@ app.UseResponseCompression();
// 정적 파일 제공 (WASM 프레임워크 파일 포함) // 정적 파일 제공 (WASM 프레임워크 파일 포함)
app.UseStaticFiles(); app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions { RequestPath = "/admin" }); app.UseStaticFiles("/admin");
app.UseStaticFiles(new StaticFileOptions { RequestPath = "/portal" }); app.UseStaticFiles("/portal");
app.UseSession(); // TempData 쿠키 저장소 app.UseSession(); // TempData 쿠키 저장소
app.UseRouting(); app.UseRouting();
@@ -394,13 +394,12 @@ app.MapHealthChecks("/healthz");
app.MapRazorPages(); // Sitemap.cshtml, Rss.cshtml, Feed.cshtml app.MapRazorPages(); // Sitemap.cshtml, Rss.cshtml, Feed.cshtml
app.MapStaticAssets(); app.MapStaticAssets();
// Blazor WebAssembly Admin Client (WASM 파일 제공 필수) // 루트 경로 기본값
app.MapRazorComponents<TaxBaik.WasmClient.Components.Admin.App>() app.MapGet("/", () => Results.Redirect("/taxbaik/"));
.AddInteractiveWebAssemblyRenderMode()
.AllowAnonymous();
// SPA 라우팅 폴백 (가장 마지막에!) // SPA 라우팅 폴백 (가장 마지막에!)
app.MapFallbackToFile("admin/{*path:nonfile}", "admin/index.html"); app.MapFallbackToFile("admin/{*path:nonfile}", "admin/index.html");
app.MapFallbackToFile("portal/{*path:nonfile}", "portal/index.html");
// 애플리케이션 시작/종료 로깅 // 애플리케이션 시작/종료 로깅
try try
+1 -1
View File
@@ -18,6 +18,6 @@
<a class="dismiss">🗙</a> <a class="dismiss">🗙</a>
</div> </div>
<script src="/_framework/blazor.webassembly.js"></script> <script src="_framework/blazor.webassembly.js"></script>
</body> </body>
</html> </html>