pub struct SecurityHeader {
pub referer_policy: RefererPolicy,
pub x_frame_options: XFrameOptions,
pub cross_origin_opener_policy: CrossOriginOpenerPolicy,
pub content_security_policy: String,
pub strict_transport_security: Option<StrictTransportSecurity>,
}Available on crate feature
security only.Expand description
Security headers applied to every response by SecurityHeader::build.
Fields§
§referer_policy: RefererPolicy§x_frame_options: XFrameOptions§cross_origin_opener_policy: CrossOriginOpenerPolicy§content_security_policy: String§strict_transport_security: Option<StrictTransportSecurity>Implementations§
Source§impl SecurityHeader
impl SecurityHeader
Sourcepub fn set_default_hsts(&mut self)
pub fn set_default_hsts(&mut self)
Set default HSTS to 1 year, includeSubDomains and preload.
max-age=31536000; includeSubDomains; preload
Sourcepub fn build(self) -> DefaultHeaders
pub fn build(self) -> DefaultHeaders
Build the actix-web DefaultHeaders middleware
carrying all configured security headers (plus HSTS when set).
Trait Implementations§
Source§impl Clone for SecurityHeader
impl Clone for SecurityHeader
Source§fn clone(&self) -> SecurityHeader
fn clone(&self) -> SecurityHeader
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SecurityHeader
impl Debug for SecurityHeader
Source§impl Default for SecurityHeader
impl Default for SecurityHeader
Source§impl<'de> Deserialize<'de> for SecurityHeader
Available on crate feature serde only.
impl<'de> Deserialize<'de> for SecurityHeader
Available on crate feature
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SecurityHeader
impl RefUnwindSafe for SecurityHeader
impl Send for SecurityHeader
impl Sync for SecurityHeader
impl Unpin for SecurityHeader
impl UnsafeUnpin for SecurityHeader
impl UnwindSafe for SecurityHeader
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