server { listen 3000; server_name _; root /usr/share/nginx/html; index index.html; # Serve client-metadata.json with correct Content-Type location = /client-metadata.json { add_header Access-Control-Allow-Origin *; } # SPA fallback location / { try_files $uri $uri/ /index.html; } # Cache static assets location ~* \.(js|css|png|jpg|svg|ico|woff2)$ { expires 1y; add_header Cache-Control "public, immutable"; } # No cache for service worker location = /sw.js { add_header Cache-Control "no-store"; } gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml; }