25 lines
638 B
Caddyfile

:4321 {
root * /srv
file_server
# Handle clean URLs - try file, then directory, then .html extension
try_files {path} {path}/ {path}.html /index.html
# Compression
encode gzip
# Service worker must not be cached
@sw path /sw.js
header @sw Cache-Control "no-cache, no-store, must-revalidate"
# Cache static assets
@static {
path *.jpg *.jpeg *.png *.gif *.ico *.css *.js *.pdf *.svg *.woff *.woff2
}
header @static Cache-Control "public, max-age=604800, immutable"
# Security headers
header X-Frame-Options "SAMEORIGIN"
header X-Content-Type-Options "nosniff"
}