# Static game files
# HTTPS is handled by Nginx Proxy Manager, which forwards to this container's port 80

:80 {
    encode zstd gzip

    root * /srv

    # Client-side routes all load the app
    try_files {path} /index.html
    file_server

    # Cache hashed Vite bundles and fonts
    @hashed path_regexp hashed ^/assets/[^/]+-[A-Za-z0-9_-]{8}\.(js|css|woff2?)$
    header @hashed Cache-Control "public, max-age=31536000, immutable"

    # Always revalidate app shell and service worker
    @shell path / /index.html /sw.js /registerSW.js /manifest.webmanifest
    header @shell Cache-Control "no-cache"
}
