pub struct MessageHandler;Expand description
Message handler for request/response manipulation.
Implementations§
Source§impl MessageHandler
impl MessageHandler
Sourcepub fn add_forwarding_headers(
request: &mut Request<BoxBody<Bytes, Error>>,
client_addr: SocketAddr,
proto: &str,
)
pub fn add_forwarding_headers( request: &mut Request<BoxBody<Bytes, Error>>, client_addr: SocketAddr, proto: &str, )
Add X-Forwarded-* headers to a request.
Sourcepub fn rewrite_host_header(
request: &mut Request<BoxBody<Bytes, Error>>,
upstream_host: &str,
)
pub fn rewrite_host_header( request: &mut Request<BoxBody<Bytes, Error>>, upstream_host: &str, )
Rewrite the Host header for upstream.
Sourcepub fn strip_path_prefix(
request: &mut Request<BoxBody<Bytes, Error>>,
prefix: &str,
)
pub fn strip_path_prefix( request: &mut Request<BoxBody<Bytes, Error>>, prefix: &str, )
Strip path prefix from request URI.
Sourcepub fn apply_route_headers(
request: &mut Request<BoxBody<Bytes, Error>>,
route: &Route,
)
pub fn apply_route_headers( request: &mut Request<BoxBody<Bytes, Error>>, route: &Route, )
Apply route-specific header modifications.
Sourcepub fn error_response(
status: StatusCode,
message: &str,
) -> Response<BoxBody<Bytes, Error>>
pub fn error_response( status: StatusCode, message: &str, ) -> Response<BoxBody<Bytes, Error>>
Create a synthetic error response.
Sourcepub fn bad_gateway(message: &str) -> Response<BoxBody<Bytes, Error>>
pub fn bad_gateway(message: &str) -> Response<BoxBody<Bytes, Error>>
Create a 502 Bad Gateway response.
Create a 503 Service Unavailable response.
Sourcepub fn gateway_timeout() -> Response<BoxBody<Bytes, Error>>
pub fn gateway_timeout() -> Response<BoxBody<Bytes, Error>>
Create a 504 Gateway Timeout response.
Auto Trait Implementations§
impl Freeze for MessageHandler
impl RefUnwindSafe for MessageHandler
impl Send for MessageHandler
impl Sync for MessageHandler
impl Unpin for MessageHandler
impl UnsafeUnpin for MessageHandler
impl UnwindSafe for MessageHandler
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more