pub struct FileHstsConfig {
pub enabled: Option<bool>,
pub max_age: Option<u32>,
pub include_subdomains: Option<bool>,
pub preload: Option<bool>,
pub force_replace_backend: Option<bool>,
}Expand description
HSTS (HTTP Strict Transport Security, RFC 6797) policy as serialised
under [https.listeners.default.hsts] (listener default) or
[clusters.<id>.frontends.hsts] (per-frontend override).
enabled is REQUIRED whenever the block is present — its presence vs
absence disambiguates “preserve current” / “explicit disable” / “enable”
on hot-reconfig partial updates.
When enabled = true and max_age is omitted, sozu substitutes
DEFAULT_HSTS_MAX_AGE (1 year) at config-load time.
Fields§
§enabled: Option<bool>REQUIRED. true enables HSTS for this scope; false suppresses
any inherited listener default (explicit-disable signal).
max_age: Option<u32>Strict-Transport-Security: max-age=<seconds>. Optional —
defaults to DEFAULT_HSTS_MAX_AGE when enabled = true.
max_age = 0 is the RFC 6797 §11.4 kill switch and is allowed
silently; 0 < max_age < 86400 warns at config-load.
include_subdomains: Option<bool>Append ; includeSubDomains to the rendered header.
preload: Option<bool>Append ; preload to the rendered header. Opt-in only — see RFC
6797 §14.2 and https://hstspreload.org/.
force_replace_backend: Option<bool>Operator opt-in to override any backend-supplied
Strict-Transport-Security header. RFC 6797 §6.1 default
behaviour is to PRESERVE the backend’s value (sozu’s edit uses
HeaderEditMode::SetIfAbsent). Set this to true to harden a
stale or weak upstream HSTS policy centrally — the materialiser
then uses HeaderEditMode::Set, replacing any backend STS with
sozu’s rendered value.
Implementations§
Source§impl FileHstsConfig
impl FileHstsConfig
Sourcepub fn to_proto(&self, scope: &str) -> Result<HstsConfig, ConfigError>
pub fn to_proto(&self, scope: &str) -> Result<HstsConfig, ConfigError>
Validate and convert the file-level FileHstsConfig into the
proto HstsConfig. scope is a human-readable string (e.g.
“listener” or “frontend api/example.com”) surfaced into errors
and warnings so the operator can pinpoint the offending block.
Validation:
enabledis required when any other field is set (HstsEnabledRequired); the parser returns the typed error so callers can fail fast.enabled = true && max_age = NonesubstitutesDEFAULT_HSTS_MAX_AGE.0 < max_age < 86400warns (likely misconfig — sub-day max-age is useful only for testing).preload = truewithmax_age < DEFAULT_HSTS_MAX_AGEorinclude_subdomains != Some(true)warns (the Chrome HSTS preload list will reject the host).max_age = 0is allowed silently (RFC 6797 §11.4 kill switch).
Trait Implementations§
Source§impl Clone for FileHstsConfig
impl Clone for FileHstsConfig
Source§fn clone(&self) -> FileHstsConfig
fn clone(&self) -> FileHstsConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileHstsConfig
impl Debug for FileHstsConfig
Source§impl<'de> Deserialize<'de> for FileHstsConfig
impl<'de> Deserialize<'de> for FileHstsConfig
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>,
Source§impl Hash for FileHstsConfig
impl Hash for FileHstsConfig
Source§impl PartialEq for FileHstsConfig
impl PartialEq for FileHstsConfig
Source§fn eq(&self, other: &FileHstsConfig) -> bool
fn eq(&self, other: &FileHstsConfig) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for FileHstsConfig
impl Serialize for FileHstsConfig
impl Eq for FileHstsConfig
impl StructuralPartialEq for FileHstsConfig
Auto Trait Implementations§
impl Freeze for FileHstsConfig
impl RefUnwindSafe for FileHstsConfig
impl Send for FileHstsConfig
impl Sync for FileHstsConfig
impl Unpin for FileHstsConfig
impl UnsafeUnpin for FileHstsConfig
impl UnwindSafe for FileHstsConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.