File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use axum::{
44} ;
55use reqwest:: Client ;
66use std:: env;
7- use crate :: { db , models :: SiteContent } ;
7+ use crate :: db ;
88
99// Default frontend URL (internal Docker network)
1010const DEFAULT_FRONTEND_URL : & str = "http://frontend" ;
Original file line number Diff line number Diff line change @@ -519,17 +519,15 @@ async fn main() {
519519
520520 . route ( "/api/health" , get ( || async { "OK" } ) )
521521
522- . with_state ( pool. clone ( ) )
522+ // Serve index.html with server-side injection for root and fallback
523+ . route ( "/" , get ( handlers:: frontend_proxy:: serve_index) )
524+ . route ( "/*path" , get ( handlers:: frontend_proxy:: serve_index) )
525+
526+ . with_state ( pool)
523527 . layer ( middleware:: from_fn ( security_headers) )
524528 . layer ( cors)
525529 . layer ( RequestBodyLimitLayer :: new ( PUBLIC_BODY_LIMIT ) ) ;
526530
527- // Serve index.html with server-side injection for root and fallback
528- // This must be added AFTER API routes to ensure they take precedence
529- app = app. route ( "/" , get ( handlers:: frontend_proxy:: serve_index) )
530- . route ( "/*path" , get ( handlers:: frontend_proxy:: serve_index) )
531- . with_state ( pool) ;
532-
533531 if !trust_proxy_ip_headers {
534532 app = app. layer ( middleware:: from_fn ( strip_untrusted_forwarded_headers) ) ;
535533 }
You can’t perform that action at this time.
0 commit comments