24 lines
520 B
Caddyfile
24 lines
520 B
Caddyfile
{$DOMAIN:localhost} {
|
|
root * /srv
|
|
|
|
# Gzip compression
|
|
encode gzip
|
|
|
|
# SPA fallback — all routes serve index.html
|
|
try_files {path} /index.html
|
|
|
|
# Cache static assets aggressively
|
|
@static {
|
|
path *.js *.css *.png *.jpg *.svg *.ico *.woff2 *.woff
|
|
}
|
|
header @static Cache-Control "public, max-age=31536000, immutable"
|
|
|
|
# Service worker must not be cached
|
|
@sw {
|
|
path /sw.js
|
|
}
|
|
header @sw Cache-Control "no-cache, no-store, must-revalidate"
|
|
|
|
file_server
|
|
}
|