1
e11sync/pkgs/e11sync-caddyfile.nix

40 lines
900 B
Nix
Raw Permalink Normal View History

2024-01-15 11:57:36 +02:00
{
writeTextFile,
e11sync-static,
backendPort ? 8002,
2024-01-15 11:57:36 +02:00
}:
writeTextFile {
name = "e11sync-caddyfile";
2024-01-15 11:57:36 +02:00
text = ''
2024-01-28 22:47:10 +02:00
@addSlash path /static /blog /contact
route @addSlash {
2024-01-28 22:59:17 +02:00
redir {uri}/ 302
2024-01-28 22:47:10 +02:00
}
2024-01-26 13:48:24 +02:00
header /static/* Cache-Control "public, max-age=31536000, immutable"
2024-01-15 11:57:36 +02:00
2024-01-28 23:18:30 +02:00
header {
Content-Security-Policy "default-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src 'self'; frame-ancestors 'none'"
Cross-Origin-Opener-Policy same-origin
Referrer-Policy same-origin
X-Content-Type-Options nosniff
-X-Frame-Options
-Last-Modified
}
2024-01-28 22:47:10 +02:00
@staticRoutes path /static/* /contact/* /blog/*
route @staticRoutes {
2024-01-15 11:57:36 +02:00
file_server * {
root ${e11sync-static}
precompressed br gzip
}
}
2024-01-28 22:59:17 +02:00
route {
encode gzip
reverse_proxy http://127.0.0.1:${toString backendPort}
}
2024-01-15 11:57:36 +02:00
'';
}