pub struct StrictTransportSecurity {
pub include_subdomains: bool,
pub preload: bool,
/* private fields */
}Expand description
HTTP Strict Transport Security (HSTS) configuration.
Care should be taken when setting up HSTS for your site; misconfiguration can potentially leave parts of your site in an unusable state.
§Default
The Default implementation uses a 5 minute max-age and does not include subdomains or
preloading. This default is intentionally conservative to prevent accidental misconfiguration
causing irrecoverable problems for users.
Once you have configured and tested the default HSTS config, recommended
can be used as a secure default for production.
§References
See the HSTS page on MDN for more information.
Fields§
§include_subdomains: boolThe includeSubdomains directive.
preload: boolThe preload directive.
Implementations§
Source§impl StrictTransportSecurity
impl StrictTransportSecurity
Sourcepub fn new(duration: Duration) -> Self
pub fn new(duration: Duration) -> Self
Constructs a new HSTS configuration using the given duration.
Other values take their default.
Sourcepub fn recommended() -> Self
pub fn recommended() -> Self
Constructs a secure, production-ready HSTS configuration.
Uses a max-age of 2 years and includes subdomains.
Sourcepub fn include_subdomains(self) -> Self
pub fn include_subdomains(self) -> Self
Send includeSubdomains directive with header.
Sourcepub fn preload(self) -> Self
pub fn preload(self) -> Self
Send preload directive with header.
See https://hstspreload.org/ for more information.
Trait Implementations§
Source§impl Clone for StrictTransportSecurity
impl Clone for StrictTransportSecurity
Source§fn clone(&self) -> StrictTransportSecurity
fn clone(&self) -> StrictTransportSecurity
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StrictTransportSecurity
impl Debug for StrictTransportSecurity
Source§impl Default for StrictTransportSecurity
impl Default for StrictTransportSecurity
Source§impl FromStr for StrictTransportSecurity
impl FromStr for StrictTransportSecurity
Source§impl Header for StrictTransportSecurity
impl Header for StrictTransportSecurity
Source§fn name() -> HeaderName
fn name() -> HeaderName
Source§fn parse<M: HttpMessage>(msg: &M) -> Result<Self, ParseError>
fn parse<M: HttpMessage>(msg: &M) -> Result<Self, ParseError>
Source§impl PartialEq for StrictTransportSecurity
impl PartialEq for StrictTransportSecurity
Source§impl TryIntoHeaderValue for StrictTransportSecurity
impl TryIntoHeaderValue for StrictTransportSecurity
Source§type Error = Infallible
type Error = Infallible
Source§fn try_into_value(self) -> Result<HeaderValue, Self::Error>
fn try_into_value(self) -> Result<HeaderValue, Self::Error>
impl Copy for StrictTransportSecurity
impl Eq for StrictTransportSecurity
impl StructuralPartialEq for StrictTransportSecurity
Auto Trait Implementations§
impl Freeze for StrictTransportSecurity
impl RefUnwindSafe for StrictTransportSecurity
impl Send for StrictTransportSecurity
impl Sync for StrictTransportSecurity
impl Unpin for StrictTransportSecurity
impl UnwindSafe for StrictTransportSecurity
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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