From 8cf34769e50f61ce4be27d738d75d951f6dd1f79 Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 9 Jul 2026 17:33:19 +0800 Subject: [PATCH] feat(not_found): commit HTTP 404 status code during SSR --- src/pages/not_found.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/not_found.rs b/src/pages/not_found.rs index 5a58d88..821b9fa 100644 --- a/src/pages/not_found.rs +++ b/src/pages/not_found.rs @@ -17,6 +17,15 @@ use crate::router::Route; pub fn NotFound(segments: Vec) -> Element { let _ = segments; + // Commit 404 status code during server-side rendering + #[cfg(feature = "server")] + { + dioxus::fullstack::FullstackContext::commit_http_status( + http::StatusCode::NOT_FOUND, + Some("Page Not Found".to_string()), + ); + } + rsx! { div { class: "flex flex-col items-center justify-center text-center min-h-[50vh] md:min-h-[55vh] px-6", // 巨大的装饰性 404,作为视觉锚点