server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; server_tokens off; # Static assets only. There is no application server and no upload endpoint. add_header Cross-Origin-Opener-Policy "same-origin" always; add_header Cross-Origin-Embedder-Policy "require-corp" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "no-referrer" always; add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; worker-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' blob: data:; connect-src 'self'; object-src 'none'; base-uri 'self'; frame-ancestors 'none'" always; types { text/html html; text/css css; text/javascript js mjs; application/json json; application/wasm wasm; application/octet-stream zjb jai; application/gzip gz; image/svg+xml svg; image/png png; text/plain txt md; } default_type application/octet-stream; gzip on; gzip_min_length 1024; gzip_types text/css text/javascript application/json application/wasm application/octet-stream; location / { try_files $uri $uri/ =404; } # The entrypoint and manifest must revalidate on a new deployment. location = /index.html { expires -1; } location = /models/manifest.json { expires -1; } # Vite assets have content hashes; model requests have SHA-256 query keys. location /assets/ { expires 1y; try_files $uri =404; } location ~ \.zjb$ { expires 1y; try_files $uri =404; } location ~ /\. { deny all; } }