Caddy's header directive makes it straightforward to inject HTTP security headers on every response. Generate the correct header block for your security policy here.
Caddy sets response headers with the header directive; prefix a name with - to remove one.
example.com {
header {
Strict-Transport-Security "max-age=63072000; includeSubDomains"
X-Content-Type-Options nosniff
Referrer-Policy strict-origin-when-cross-origin
-Server
}
}CSP is the header that needs the most care. Start report-only, watch for violations, then enforce.
Open the Security headers generator
Yes, header applies to all responses from that site unless you scope it with a matcher.