Struct HttpForwardProxyLayer
pub struct HttpForwardProxyLayer { /* private fields */ }http and std only.Expand description
HTTP middleware for requests sent directly to an HTTP forward proxy.
The layer resolves EstablishedProxyRoute from the wrapped connection.
The wrapped connection’s extensions, including an absent route, take
precedence over all request metadata. This lets
the layer distinguish a real forward-proxy connection from direct, SOCKS,
and HTTP CONNECT-tunneled connections after route fallback and pool lookup
have completed.
Configured Basic or Bearer credentials are inserted by default. Call
Self::with_proxy_auth with false to disable insertion. Caller-provided
Proxy-Authorization headers are always stripped on direct, SOCKS,
CONNECT-tunneled, or unclassified connections, even with insertion disabled.
Manual authentication is preserved only on established HTTP forward routes.
A proxy-generated 407 response is exposed by default for ordinary HTTP
clients; intermediary clients can enable Self::with_isolate_auth_error to turn it into
HttpForwardProxyAuthRequired before any proxy response headers or body
reach their downstream peer.
Custom proxy connectors must publish EstablishedProxyRoute in their
established connection extensions. Missing metadata or a forward route
with a non-HTTP proxy protocol disables forward-proxy behavior and never
falls back to request-side routes or credentials.
Implementations§
§impl HttpForwardProxyLayer
impl HttpForwardProxyLayer
pub fn new() -> HttpForwardProxyLayer
pub fn new() -> HttpForwardProxyLayer
Create a layer which inserts configured proxy credentials and exposes
proxy-generated 407 responses.
pub fn with_proxy_auth(self, enabled: bool) -> HttpForwardProxyLayer
pub fn with_proxy_auth(self, enabled: bool) -> HttpForwardProxyLayer
Enable or disable preemptive Basic or Bearer authentication for HTTP forward-proxy requests.
This controls insertion only. Caller-provided Proxy-Authorization
is preserved on established HTTP forward routes and always stripped
on every other route, including connections without route metadata.
pub fn set_proxy_auth(&mut self, enabled: bool) -> &mut HttpForwardProxyLayer
pub fn set_proxy_auth(&mut self, enabled: bool) -> &mut HttpForwardProxyLayer
Enable or disable preemptive Basic or Bearer authentication for HTTP forward-proxy requests.
This controls insertion only. Caller-provided Proxy-Authorization
is preserved on established HTTP forward routes and always stripped
on every other route, including connections without route metadata.
pub fn with_isolate_auth_error(self, enabled: bool) -> HttpForwardProxyLayer
pub fn with_isolate_auth_error(self, enabled: bool) -> HttpForwardProxyLayer
Enable or disable isolation of a forward proxy’s 407 response.
When enabled, the response is dropped and
HttpForwardProxyAuthRequired is returned. This is intended for
intermediary services which must not expose one proxy hop’s challenge
to a different downstream proxy client.
pub fn set_isolate_auth_error(
&mut self,
enabled: bool,
) -> &mut HttpForwardProxyLayer
pub fn set_isolate_auth_error( &mut self, enabled: bool, ) -> &mut HttpForwardProxyLayer
Enable or disable isolation of a forward proxy’s 407 response.
When enabled, the response is dropped and
HttpForwardProxyAuthRequired is returned. This is intended for
intermediary services which must not expose one proxy hop’s challenge
to a different downstream proxy client.
Trait Implementations§
§impl Clone for HttpForwardProxyLayer
impl Clone for HttpForwardProxyLayer
§fn clone(&self) -> HttpForwardProxyLayer
fn clone(&self) -> HttpForwardProxyLayer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for HttpForwardProxyLayer
impl Debug for HttpForwardProxyLayer
§impl Default for HttpForwardProxyLayer
impl Default for HttpForwardProxyLayer
§fn default() -> HttpForwardProxyLayer
fn default() -> HttpForwardProxyLayer
§impl<S> Layer<S> for HttpForwardProxyLayer
impl<S> Layer<S> for HttpForwardProxyLayer
§type Service = HttpForwardProxyService<S>
type Service = HttpForwardProxyService<S>
§fn layer(&self, inner: S) -> <HttpForwardProxyLayer as Layer<S>>::Service
fn layer(&self, inner: S) -> <HttpForwardProxyLayer as Layer<S>>::Service
§fn into_layer(self, inner: S) -> <HttpForwardProxyLayer as Layer<S>>::Service
fn into_layer(self, inner: S) -> <HttpForwardProxyLayer as Layer<S>>::Service
layer but consuming self after the service was created. Read moreAuto Trait Implementations§
impl Freeze for HttpForwardProxyLayer
impl RefUnwindSafe for HttpForwardProxyLayer
impl Send for HttpForwardProxyLayer
impl Sync for HttpForwardProxyLayer
impl Unpin for HttpForwardProxyLayer
impl UnsafeUnpin for HttpForwardProxyLayer
impl UnwindSafe for HttpForwardProxyLayer
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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> ⓘ
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more