pub struct HttpsRedirect { /* private fields */ }Expand description
Redirect plain HTTP to HTTPS with an explicit proxy and authority policy.
Forwarded scheme headers are ignored by default. Configure exact trusted
socket peers with Self::trusted_proxies; those proxies must replace
client-supplied forwarded headers. Incoming HTTP ports are removed by
default, preserving IPv6 brackets. Set a canonical authority for a custom
HTTPS port or deployment host, and an allow-list for incoming hosts.
Implementations§
Source§impl HttpsRedirect
impl HttpsRedirect
Sourcepub fn trusted_proxies(self, proxies: TrustedProxies) -> Self
pub fn trusted_proxies(self, proxies: TrustedProxies) -> Self
Configure exact trusted proxy peers using the shared policy.
Args: proxies: Immediate peers required to replace forwarded headers.
Returns: Redirect middleware with explicit forwarded-scheme trust.
Sourcepub fn trust_forwarded_proto(self, trust: bool) -> Self
pub fn trust_forwarded_proto(self, trust: bool) -> Self
Explicit compatibility trust for forwarded scheme from any source.
Args: trust: Blanket ingress trust; false restores the safe default.
Returns: Middleware using the selected forwarded-scheme policy.
Set an explicit HTTPS destination, including an optional port.
Args: authority: Parsed destination without user info.
Returns: Middleware with a fixed destination; invalid user info yields 400.
Sourcepub fn allowed_hosts(self, hosts: TrustedHosts) -> Self
pub fn allowed_hosts(self, hosts: TrustedHosts) -> Self
Validate incoming hosts before redirecting or invoking the origin.
Args: hosts: Case-insensitive host allow-list with wildcard support.
Returns: Middleware rejecting missing, malformed or disallowed hosts.
Trait Implementations§
Source§impl Clone for HttpsRedirect
impl Clone for HttpsRedirect
Source§fn clone(&self) -> HttpsRedirect
fn clone(&self) -> HttpsRedirect
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpsRedirect
impl Debug for HttpsRedirect
Source§impl Default for HttpsRedirect
impl Default for HttpsRedirect
Source§fn default() -> HttpsRedirect
fn default() -> HttpsRedirect
Source§impl Layer<BoxCloneSyncService<Request<Body>, Response<Body>, Infallible>> for HttpsRedirect
impl Layer<BoxCloneSyncService<Request<Body>, Response<Body>, Infallible>> for HttpsRedirect
Source§type Service = BoxCloneSyncService<Request<Body>, Response<Body>, Infallible>
type Service = BoxCloneSyncService<Request<Body>, Response<Body>, Infallible>
Source§fn layer(&self, inner: BoxService) -> Self::Service
fn layer(&self, inner: BoxService) -> Self::Service
Auto Trait Implementations§
impl !Freeze for HttpsRedirect
impl RefUnwindSafe for HttpsRedirect
impl Send for HttpsRedirect
impl Sync for HttpsRedirect
impl Unpin for HttpsRedirect
impl UnsafeUnpin for HttpsRedirect
impl UnwindSafe for HttpsRedirect
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
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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read more§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read more§fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
413 Payload Too Large responses. Read more