From b84fe4e5c75f726d0c48b02f899a687ae990366b Mon Sep 17 00:00:00 2001 From: riyadhafraa <49757212-riyadhafraa@users.noreply.replit.com> Date: Tue, 19 May 2026 20:17:47 +0000 Subject: [PATCH] Update caching headers to ensure all devices get the latest site version Modify Nginx configuration to include aggressive caching headers for service worker and index.html to prevent stale content on various devices. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 77cfe984-2c65-4152-bb7a-0df28274fe66 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 5c11d21b-1972-4651-a7a2-5deab7b263d1 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/c3c252e4-c83d-40ca-9fff-99a3ea60701e/77cfe984-2c65-4152-bb7a-0df28274fe66/IO8TMSC Replit-Helium-Checkpoint-Created: true --- docker/nginx.conf | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/docker/nginx.conf b/docker/nginx.conf index bac6c3a7..09726610 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -43,11 +43,28 @@ server { try_files $uri =404; } - # SPA fallback — every unknown path returns index.html + # Service worker MUST never be cached so we can ship SW updates. + # Safari/iOS especially clings to old sw.js otherwise. + location = /sw.js { + root /usr/share/nginx/html; + add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0"; + add_header Pragma "no-cache"; + add_header Expires "0"; + try_files $uri =404; + } + + # SPA fallback — every unknown path returns index.html. + # `no-cache` alone is unreliable on iOS Safari (sometimes the browser + # serves a stale copy after a deploy). Pair it with `no-store` + the + # legacy `Pragma`/`Expires` headers so every device — phones, iPads, + # laptops — re-fetches index.html and picks up the freshly-hashed + # assets/*.js bundle on every navigation. location / { root /usr/share/nginx/html; index index.html; try_files $uri $uri/ /index.html; - add_header Cache-Control "no-cache"; + add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0"; + add_header Pragma "no-cache"; + add_header Expires "0"; } }