server { listen 80; root /usr/share/nginx/html; index index.html; gzip on; gzip_types text/css application/javascript application/json image/svg+xml application/wasm; client_max_body_size 1m; # pdf.js worker ships as hashed .mjs; module workers need a JavaScript MIME type. location ~* \.mjs$ { types { } default_type application/javascript; expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } location = /health { access_log off; default_type text/plain; return 200 "ok\n"; } # Vite assets carry a content hash -> cache forever. location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; try_files $uri =404; } # Unhashed static files (fonts, logo, pdf.js cmaps): cache, but revalidate. location ~* \.(?:woff2?|ttf|png|jpg|jpeg|gif|ico|webp|svg|bcmap|pfb)$ { add_header Cache-Control "public, max-age=86400"; try_files $uri =404; } # index.html must always be fresh so users get new releases. location / { add_header Cache-Control "no-cache"; try_files $uri $uri/ /index.html; } }