chore: add caddy common defaults

This commit is contained in:
oddlama 2023-06-17 23:46:15 +02:00
parent 9ed52a253c
commit b682db7173
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
4 changed files with 35 additions and 9 deletions

View file

@ -48,6 +48,29 @@ in {
extraDomainNames = ["*.${domain}"];
});
# Sensible defaults for caddy
services.caddy = mkIf config.services.caddy.enable {
globalConfig = ''
(common) {
encode zstd gzip
header {
# Enable HTTP Strict Transport Security (HSTS)
Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
X-XSS-Protection "1; mode=block"
X-Frame-Options "DENY"
X-Content-Type-Options "nosniff"
# Remove unnecessary information and remove Last-Modified in favor of ETag
-Server
-X-Powered-By
-Last-Modified
}
}
'';
};
# Sensible defaults for nginx
services.nginx = mkIf config.services.nginx.enable {
recommendedBrotliSettings = true;