From 96da4a575ebcfa38ab0a789ac8c25a0af03896a7 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 5 Feb 2025 13:00:26 +0100 Subject: fix fallback module --- src/modules/fallback.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/modules/fallback.rs b/src/modules/fallback.rs index b0deed1..6a5caaa 100644 --- a/src/modules/fallback.rs +++ b/src/modules/fallback.rs @@ -36,7 +36,7 @@ impl Node for Fallback { for (i, h) in self.0.iter().enumerate() { let last = i == self.0.len() - 1; - let resp = h + let res = h .handle( context, Request::from_parts( @@ -44,13 +44,17 @@ impl Node for Fallback { BoxBody::new(Full::new(body.clone()).map_err(|x| match x {})), ), ) - .await?; - if resp.status().is_success() - || resp.status().is_redirection() - || resp.status().is_informational() - || last - { - return Ok(resp); + .await; + if last { + return res; + } + if let Ok(resp) = res { + if resp.status().is_success() + || resp.status().is_redirection() + || resp.status().is_informational() + { + return Ok(resp); + } } } return Err(ServiceError::CustomStatic( -- cgit v1.2.3-70-g09d2