caddy: use snippet for headers, format with caddy fmt

main
teutat3s 5 months ago
parent 1acf62b413
commit db55583367
Signed by: teutat3s
GPG Key ID: 4FA1D3FA524F22C1
  1. 68
      Caddyfile

@ -1,44 +1,48 @@
# global options
{
# remove comment to use staging Let's Encrypt servers (for testing)
# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
# remove comment to use staging Let's Encrypt servers (for testing)
# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
# auto_https contact mail address, for TLS certs notifications (expiry,
# other problems with certs)
email admins@pub.solar
# auto_https contact mail address, for TLS certs notifications (expiry,
# other problems with certs)
email admins@pub.solar
}
# static file server
miom.space {
root * /srv/miom.space
file_server
# caddys default is no access logs at all
# comment this block out for debugging
#log {
# output file /var/log/caddy-access.log
#}
}
# security and privacy header snippet
(security_headers) {
header {
# disable FLoC tracking
Permissions-Policy interest-cohort=()
# redirect www. subdomain to apex (root) domain
www.miom.space {
redir https://miom.space{uri}
}
# enable HSTS
Strict-Transport-Security max-age=63072000;
# security and privacy headers
header {
# disable FLoC tracking
Permissions-Policy interest-cohort=()
# disable clients from sniffing the media type
X-Content-Type-Options nosniff
# enable HSTS
Strict-Transport-Security max-age=63072000;
# clickjacking protection
X-Frame-Options DENY
# disable clients from sniffing the media type
X-Content-Type-Options nosniff
# keep referrer data off of HTTP connections
Referrer-Policy no-referrer-when-downgrade
}
}
# clickjacking protection
X-Frame-Options DENY
# static file server
miom.space {
import security_headers
root * /srv/miom.space
file_server
# caddys default is no access logs at all
# comment this block out for debugging
#log {
# output file /var/log/caddy-access.log
#}
}
# keep referrer data off of HTTP connections
Referrer-Policy no-referrer-when-downgrade
# redirect www. subdomain to apex (root) domain
www.miom.space {
import security_headers
redir https://miom.space{uri}
}

Loading…
Cancel
Save