From e3f3a3ced8e3e10119d114e163d9d05aabe7d215 Mon Sep 17 00:00:00 2001 From: trent Date: Tue, 11 Aug 2026 05:53:36 +0800 Subject: [PATCH] fis issue with blocked js files --- vigilcare-dashboard/nginx.conf | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/vigilcare-dashboard/nginx.conf b/vigilcare-dashboard/nginx.conf index c79c3ab..deae413 100644 --- a/vigilcare-dashboard/nginx.conf +++ b/vigilcare-dashboard/nginx.conf @@ -9,23 +9,26 @@ server { root /usr/share/nginx/html; index index.html; - # Vue Router uses history mode — every unmatched path must fall through - # to index.html or a hard refresh on /alerts returns 404. - location / { - try_files $uri $uri/ /index.html; - } - - # Hashed assets are immutable; index.html must never be cached or clients - # keep loading the previous release's asset manifest. + # Hashed Vite chunks must 404 as application/octet-stream/empty — never + # fall through to index.html (that yields MIME "text/html" and breaks + # dynamic import() in the browser). location /assets/ { + try_files $uri =404; expires 1y; add_header Cache-Control "public, immutable"; + access_log off; } + location = /index.html { add_header Cache-Control "no-cache, no-store, must-revalidate"; } + # Vue Router history mode — unmatched paths fall through to the SPA shell. + location / { + try_files $uri $uri/ /index.html; + } + gzip on; gzip_types text/css application/javascript application/json image/svg+xml; gzip_min_length 1024; -} \ No newline at end of file +}