livery_security_headers (livery v0.2.0)
View SourceSecurity-headers middleware.
Decorates responses with baseline hardening headers. Configure it as a
stack entry {livery_security_headers, Config} where every Config
key is optional and a value of false disables that header:
content_type_options—true(default) sendsX-Content-Type-Options: nosniff.frame_options— header value, default<<"DENY">>.referrer_policy— header value, default<<"no-referrer">>.csp—Content-Security-Policyvalue, defaultfalse(off): a wrong policy breaks apps, so it is opt-in.hsts—#{max_age => Secs, include_subdomains => boolean(), preload => boolean()}(defaults31536000,true,false), orfalse.Strict-Transport-Securityis only emitted on secure (HTTPS / TLS) requests; on plain HTTP it is meaningless and skipped.
Each header is set only when the handler did not already set it, so a handler can override any of them per response.
Summary
Functions
Add the configured security headers to the downstream response.
Functions
-spec call(livery_req:req(), livery_middleware:next(), map() | undefined) -> livery_resp:resp().
Add the configured security headers to the downstream response.