server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # AudioWorkletProcessor needs the worklet served as a real JS module. types { application/javascript js; text/html html; text/css css; image/svg+xml svg; } # Static index — short cache so updates land quickly after a redeploy. location = / { try_files /index.html =404; add_header Cache-Control "no-cache, must-revalidate"; } location = /index.html { add_header Cache-Control "no-cache, must-revalidate"; } # Worklet: revalidate on every load (it changes whenever we touch the engine). location = /worklet.js { add_header Cache-Control "no-cache, must-revalidate"; } # Everything else (sandbox/, future static assets) gets a moderate cache. location / { try_files $uri $uri/ =404; add_header Cache-Control "public, max-age=300"; } # Gzip the text payloads. gzip on; gzip_types text/plain text/css application/javascript application/json image/svg+xml; gzip_min_length 256; }