From 6d5dd23a6b1e5bf146254f753e3f40ac1fa4ba33 Mon Sep 17 00:00:00 2001 From: oabrivard Date: Thu, 2 Apr 2026 23:21:02 +0200 Subject: [PATCH] fix: SPA fallback returns 200 instead of 404 for client-side routes ServeDir::not_found_service serves index.html but preserves the 404 status code. Switch to ServeDir::fallback which returns 200, fixing client-side routes like /login returning 404 to the browser. Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/src/router.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/router.rs b/backend/src/router.rs index a239730..1793941 100644 --- a/backend/src/router.rs +++ b/backend/src/router.rs @@ -100,7 +100,7 @@ pub fn build_router(state: AppState, config: &AppConfig) -> Router { let index_file = format!("{}/index.html", static_dir); let spa_fallback = - ServeDir::new(&static_dir).not_found_service(ServeFile::new(&index_file)); + ServeDir::new(&static_dir).fallback(ServeFile::new(&index_file)); // Build the full application with state let mut app = Router::new()