# EloRank behind Caddy. # # The app is a static SPA with no backend: Caddy only serves files and rewrites # unknown paths to index.html so deep links like /categories/2/leaderboard work # on a hard refresh. # # caddy run --config Caddyfile # # Point `root` at the Nix build output (a symlink is fine): # nix build && caddy run --config Caddyfile elorank.example.com { root * /var/www/elorank encode zstd gzip # Fingerprinted bundles are immutable - cache them hard. @assets path /assets/* header @assets Cache-Control "public, max-age=31536000, immutable" # The shell and the service worker must always be revalidated, otherwise a # deploy is invisible to clients that already installed the PWA. @shell path /index.html / /sw.js /registerSW.js /manifest.webmanifest header @shell Cache-Control "no-cache" header { X-Content-Type-Options nosniff Referrer-Policy strict-origin-when-cross-origin # No network calls at all: everything is bundled and stored locally. Content-Security-Policy "default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline'; connect-src 'self'" } # Client-side routing: anything that is not a real file falls back to the shell. try_files {path} /index.html file_server }