server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; location /api/ { proxy_pass http://backend:3000/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location / { try_files $uri $uri/ /index.html; } # Always revalidate the HTML shell so it never points at a stale, no-longer-existing # hashed JS/CSS bundle after a new deploy. location = /index.html { add_header Cache-Control "no-cache"; } location ~* \.(?:js|css|png|jpg|jpeg|svg|woff2?)$ { expires 7d; add_header Cache-Control "public"; } # Never cache the service worker or manifest so updates roll out immediately location = /sw.js { add_header Cache-Control "no-cache"; } location = /manifest.webmanifest { default_type application/manifest+json; add_header Cache-Control "no-cache"; } }