From 2a3810d25d922fdb683cb5c84834a49832e0724d Mon Sep 17 00:00:00 2001 From: vansh17June Date: Sun, 19 Jul 2026 18:53:13 +0530 Subject: [PATCH] fix(nginx): add no-cache header for index.html to prevent stale SPA shell --- apps/admin/nginx/nginx.conf | 10 ++++++++++ apps/web/nginx/nginx.conf | 16 ++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/admin/nginx/nginx.conf b/apps/admin/nginx/nginx.conf index 36f62812868..9ba7b9b2a34 100644 --- a/apps/admin/nginx/nginx.conf +++ b/apps/admin/nginx/nginx.conf @@ -26,6 +26,16 @@ http { add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header X-XSS-Protection "1; mode=block" always; + location = /god-mode/index.html { + root /usr/share/nginx/html; + add_header X-Frame-Options "DENY" always; + add_header X-Content-Type-Options "nosniff" always; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header Cache-Control "no-cache, must-revalidate" always; + try_files $uri =404; + } + location / { root /usr/share/nginx/html; index index.html index.htm; diff --git a/apps/web/nginx/nginx.conf b/apps/web/nginx/nginx.conf index b6719971cde..27babd12b1c 100644 --- a/apps/web/nginx/nginx.conf +++ b/apps/web/nginx/nginx.conf @@ -26,11 +26,23 @@ http { add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header X-XSS-Protection "1; mode=block" always; + # index.html is not content-hashed like /assets/*, so it must never be + # cached long-term. Safari/iOS's aggressive heuristic caching can otherwise + # keep serving a stale shell indefinitely, even after a fix is deployed. + location = /index.html { + root /usr/share/nginx/html; + add_header X-Frame-Options "DENY" always; + add_header X-Content-Type-Options "nosniff" always; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; + add_header X-XSS-Protection "1; mode=block" always; + add_header Cache-Control "no-cache, must-revalidate" always; + try_files $uri =404; + } + location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; } } -} - +} \ No newline at end of file