This commit is contained in:
Mateusz Gruszczyński committed 2026-10-10 00:18:06 +02:00
1 parent ad95bfb050
commit 1431dd47f0
62 files changed
+1360 -198

No files matched your search

+26
View File
@@ -181,3 +181,29 @@ async fn execute_error_fallback(
}
Some(response)
}
/// Called only for a response supplied by the Web Server or an HTTP origin.
/// Routing/security failures and internal fallback responses are excluded.
fn intercept_route_origin_error(
response: Response,
route: &crate::config::CompiledRoute,
snapshot: &crate::config::Snapshot,
) -> Response {
// An internal named location is the final, administrator-selected fallback
// representation. Interception inside its nested forward_request would
// otherwise erase its 404 HTML before ErrorFallbackResponse is attached.
if route.internal {
return response;
}
let mut response = if let Some(frontend) = route.frontend.as_ref() {
crate::pages::intercept_application_error(
response,
&frontend.pages,
&snapshot.envelope.config.pages,
)
} else {
response
};
response.extensions_mut().insert(crate::pages::OriginProvidedResponse);
response
}