pub struct RequestHandlerChain(/* private fields */);Expand description
Chains multiple request handlers, trying each in order.
Returns the first successful result, or the last error if all handlers fail. Useful for supporting both forward and reverse proxy modes simultaneously.
§Example
ⓘ
let handler = RequestHandlerChain::default()
.push(StaticForwardProxy(upstream_id))
.push(StaticReverseProxy(destination));Implementations§
Source§impl RequestHandlerChain
impl RequestHandlerChain
Sourcepub fn push(self, handler: impl RequestHandler + 'static) -> Self
pub fn push(self, handler: impl RequestHandler + 'static) -> Self
Appends a handler to the chain.
Trait Implementations§
Source§impl Default for RequestHandlerChain
impl Default for RequestHandlerChain
Source§fn default() -> RequestHandlerChain
fn default() -> RequestHandlerChain
Returns the “default value” for a type. Read more
Source§impl RequestHandler for RequestHandlerChain
impl RequestHandler for RequestHandlerChain
Source§async fn handle_request(
&self,
src_addr: SrcAddr,
req: &mut HttpRequest,
) -> Result<EndpointId, Deny>
async fn handle_request( &self, src_addr: SrcAddr, req: &mut HttpRequest, ) -> Result<EndpointId, Deny>
Determines the upstream endpoint for this request. Read more
Auto Trait Implementations§
impl Freeze for RequestHandlerChain
impl !RefUnwindSafe for RequestHandlerChain
impl Send for RequestHandlerChain
impl Sync for RequestHandlerChain
impl Unpin for RequestHandlerChain
impl UnsafeUnpin for RequestHandlerChain
impl !UnwindSafe for RequestHandlerChain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more