forked from colin/resume
2
0
Fork 0

Optimize Caddyfile for better performance

This commit is contained in:
Your Name 2025-03-31 09:24:24 -04:00
parent 3598c99b9f
commit 3d0dd2c361
1 changed files with 23 additions and 2 deletions

View File

@ -1,9 +1,9 @@
:8080 {
root * .
file_server
encode gzip
encode gzip brotli
# Security headers
# Performance optimizations
header {
# Remove default Caddy headers
-Server
@ -25,6 +25,9 @@
Cross-Origin-Resource-Policy "same-origin"
Cross-Origin-Opener-Policy "same-origin"
# Cache control for static assets
Cache-Control "public, max-age=31536000, immutable"
# CSP with hash for utils.js and nonce for inline scripts
Content-Security-Policy "default-src 'none'; script-src 'self' 'sha256-ryQsJ+aghKKD/CeXgx8jtsnZT3Epp3EjIw8RyHIq544='; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none';"
}
@ -39,4 +42,22 @@
output stdout
format json
}
# Enable HTTP/2
protocols h2c h2 http/1.1
# Enable automatic HTTPS redirect
tls internal
# Enable automatic compression
encode {
gzip
brotli
}
# Enable static file serving with caching
file_server {
precompressed
browse
}
}