forked from colin/resume
Optimize Caddyfile for better performance
This commit is contained in:
parent
3598c99b9f
commit
3d0dd2c361
|
@ -1,9 +1,9 @@
|
||||||
:8080 {
|
:8080 {
|
||||||
root * .
|
root * .
|
||||||
file_server
|
file_server
|
||||||
encode gzip
|
encode gzip brotli
|
||||||
|
|
||||||
# Security headers
|
# Performance optimizations
|
||||||
header {
|
header {
|
||||||
# Remove default Caddy headers
|
# Remove default Caddy headers
|
||||||
-Server
|
-Server
|
||||||
|
@ -25,6 +25,9 @@
|
||||||
Cross-Origin-Resource-Policy "same-origin"
|
Cross-Origin-Resource-Policy "same-origin"
|
||||||
Cross-Origin-Opener-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
|
# 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';"
|
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
|
output stdout
|
||||||
format json
|
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
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue