pub struct ChannelSecurityConfig { /* private fields */ }Expand description
Configuration for channel security
Implementations§
Source§impl ChannelSecurityConfig
impl ChannelSecurityConfig
Sourcepub fn require_https_everywhere() -> Self
pub fn require_https_everywhere() -> Self
Require HTTPS for all paths (strict mode)
Sourcepub fn require_https(self, patterns: &[&str]) -> Self
pub fn require_https(self, patterns: &[&str]) -> Self
Add paths that require HTTPS
Sourcepub fn allow_http(self, patterns: &[&str]) -> Self
pub fn allow_http(self, patterns: &[&str]) -> Self
Add paths that allow HTTP
Sourcepub fn default_requirement(self, requirement: ChannelRequirement) -> Self
pub fn default_requirement(self, requirement: ChannelRequirement) -> Self
Set the default requirement for paths not matching any rule
Sourcepub fn port_mapper(self, http_port: u16, https_port: u16) -> Self
pub fn port_mapper(self, http_port: u16, https_port: u16) -> Self
Set custom port mapping
Sourcepub fn redirect_status(self, status: StatusCode) -> Self
pub fn redirect_status(self, status: StatusCode) -> Self
Set the HTTP redirect status code (default: 301 Moved Permanently)
Common values:
- 301: Moved Permanently (cached by browsers)
- 302: Found (temporary redirect)
- 307: Temporary Redirect (preserves method)
- 308: Permanent Redirect (preserves method, cached)
Sourcepub fn temporary_redirect(self) -> Self
pub fn temporary_redirect(self) -> Self
Use temporary redirect (302 Found)
Sourcepub fn permanent_redirect_preserve_method(self) -> Self
pub fn permanent_redirect_preserve_method(self) -> Self
Use permanent redirect that preserves HTTP method (308)
Sourcepub fn preserve_host(self, preserve: bool) -> Self
pub fn preserve_host(self, preserve: bool) -> Self
Set whether to preserve the Host header in redirects
Trait Implementations§
Source§impl Clone for ChannelSecurityConfig
impl Clone for ChannelSecurityConfig
Source§fn clone(&self) -> ChannelSecurityConfig
fn clone(&self) -> ChannelSecurityConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChannelSecurityConfig
impl Debug for ChannelSecurityConfig
Auto Trait Implementations§
impl Freeze for ChannelSecurityConfig
impl RefUnwindSafe for ChannelSecurityConfig
impl Send for ChannelSecurityConfig
impl Sync for ChannelSecurityConfig
impl Unpin for ChannelSecurityConfig
impl UnwindSafe for ChannelSecurityConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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