plume/strict_transport_security
Strict-Transport-Security
This response header (often abbreviated as HSTS) lets a site tell browsers that it should only be accessed using HTTPS, and that any future attempts to access it using HTTP should be automatically converted to HTTPS. This helps protect against protocol downgrade attacks and cookie hijacking.
See the MDN docs.
Types
A Strict-Transport-Security header value.
pub type StrictTransportSecurity {
MaxAge(seconds: Int)
IncludeSubDomains(seconds: Int)
Preload(seconds: Int)
}
Constructors
-
MaxAge(seconds: Int)Apply only to the current host, for
secondsseconds. UseMaxAge(0)to clear a previously-set HSTS policy in browsers. -
IncludeSubDomains(seconds: Int)Apply to the current host and all subdomains, for
secondsseconds. Plume default. -
Preload(seconds: Int)Apply to the current host and all subdomains, for
secondsseconds, and signal consent to be included in browsers’ HSTS preload lists.The preload list also requires
secondsto be at least31_536_000(one year).
Values
pub fn to_string(value: StrictTransportSecurity) -> String
Encode as the Strict-Transport-Security header value.