Struct actix_web_lab::header::StrictTransportSecurity
source · [−]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
sourceimpl 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
sourceimpl Clone for StrictTransportSecurity
impl Clone for StrictTransportSecurity
sourcefn clone(&self) -> StrictTransportSecurity
fn clone(&self) -> StrictTransportSecurity
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl Debug for StrictTransportSecurity
impl Debug for StrictTransportSecurity
sourceimpl Default for StrictTransportSecurity
impl Default for StrictTransportSecurity
sourceimpl FromStr for StrictTransportSecurity
impl FromStr for StrictTransportSecurity
sourceimpl Header for StrictTransportSecurity
impl Header for StrictTransportSecurity
sourcefn name() -> HeaderName
fn name() -> HeaderName
sourcefn parse<M: HttpMessage>(msg: &M) -> Result<Self, ParseError>
fn parse<M: HttpMessage>(msg: &M) -> Result<Self, ParseError>
sourceimpl PartialEq<StrictTransportSecurity> for StrictTransportSecurity
impl PartialEq<StrictTransportSecurity> for StrictTransportSecurity
sourcefn eq(&self, other: &StrictTransportSecurity) -> bool
fn eq(&self, other: &StrictTransportSecurity) -> bool
sourceimpl TryIntoHeaderValue for StrictTransportSecurity
impl TryIntoHeaderValue for StrictTransportSecurity
type Error = Infallible
type Error = Infallible
sourcefn 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 StructuralEq for StrictTransportSecurity
impl StructuralPartialEq for StrictTransportSecurity
Auto Trait Implementations
impl RefUnwindSafe for StrictTransportSecurity
impl Send for StrictTransportSecurity
impl Sync for StrictTransportSecurity
impl Unpin for StrictTransportSecurity
impl UnwindSafe for StrictTransportSecurity
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.