Skip to content

Commit 02e5d2a

Browse files
committed
v0.5.1
1 parent eb4def2 commit 02e5d2a

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.5.1
2+
## Changes
3+
1. Revert 0.5.0 `set_default_hsts` changes.
4+
15
# 0.5.0
26
## Breaking changes
37
1. `set_default_hsts` is removed, now is default.

actix-cloud/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "actix-cloud"
3-
version = "0.5.0"
3+
version = "0.5.1"
44
edition = "2021"
55
authors = ["MXWXZ <matrixwxz@gmail.com>"]
66
description = "Actix Cloud is an all-in-one web framework based on Actix Web."

actix-cloud/src/security.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,19 @@ impl Default for SecurityHeader {
125125
x_xss_protection: XXSSProtection::EnableBlock,
126126
cross_origin_opener_policy: CrossOriginOpenerPolicy::SameOrigin,
127127
content_security_policy: String::from("default-src 'none'; script-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'"),
128-
strict_transport_security: Some(StrictTransportSecurity::Preload(31536000)),
128+
strict_transport_security: None,
129129
}
130130
}
131131
}
132132

133133
impl SecurityHeader {
134+
/// Set default HSTS to 1 year, includeSubDomains and preload.
135+
///
136+
/// `max-age=31536000; includeSubDomains; preload`
137+
pub fn set_default_hsts(&mut self) {
138+
self.strict_transport_security = Some(StrictTransportSecurity::Preload(31536000));
139+
}
140+
134141
pub fn build(self) -> middleware::DefaultHeaders {
135142
let mut ret = middleware::DefaultHeaders::new()
136143
.add(("X-Content-Type-Options", "nosniff"))

0 commit comments

Comments
 (0)