Struct actix_web_lab::header::Hsts
source · [−]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: bool
The includeSubdomains
directive.
preload: bool
The preload
directive.
Implementations
sourceimpl Hsts
impl Hsts
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
sourceimpl Header for Hsts
impl Header for Hsts
sourcefn name() -> HeaderName
fn name() -> HeaderName
Returns the name of the header field.
sourcefn parse<M: HttpMessage>(_msg: &M) -> Result<Self, ParseError>
fn parse<M: HttpMessage>(_msg: &M) -> Result<Self, ParseError>
Parse the header from a HTTP message.
sourceimpl TryIntoHeaderValue for Hsts
impl TryIntoHeaderValue for Hsts
type Error = Infallible
type Error = Infallible
The type returned in the event of a conversion error.
sourcefn try_into_value(self) -> Result<HeaderValue, Self::Error>
fn try_into_value(self) -> Result<HeaderValue, Self::Error>
Try to convert value to a HeaderValue.
impl Copy for Hsts
Auto Trait Implementations
impl RefUnwindSafe for Hsts
impl Send for Hsts
impl Sync for Hsts
impl Unpin for Hsts
impl UnwindSafe for Hsts
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> TryIntoHeaderPair for T where
T: Header,
impl<T> TryIntoHeaderPair for T where
T: Header,
type Error = <T as TryIntoHeaderValue>::Error
fn try_into_pair(
self
) -> Result<(HeaderName, HeaderValue), <T as TryIntoHeaderPair>::Error>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more