From d52180dcf124f8681221e15bfb268ce42a844060 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Thu, 23 May 2024 14:29:55 +0200 Subject: [PATCH] HTTP Strict Transport Security --- crates/common/src/config/jmap/settings.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/common/src/config/jmap/settings.rs b/crates/common/src/config/jmap/settings.rs index a2ff11f6..0fd80d33 100644 --- a/crates/common/src/config/jmap/settings.rs +++ b/crates/common/src/config/jmap/settings.rs @@ -137,6 +137,16 @@ impl JmapConfig { )); } + // Add HTTP Strict Transport Security + if config.property::("server.http.hsts").unwrap_or(false) { + http_headers.push(( + hyper::header::STRICT_TRANSPORT_SECURITY, + hyper::header::HeaderValue::from_static( + "max-age=31536000; includeSubDomains; preload", + ), + )); + } + let mut jmap = JmapConfig { default_language: Language::from_iso_639( config