From bd51c142f607d32d05c591416857cd52e4cba870 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 12 Aug 2026 19:40:47 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(frontend)=20return=20real=20404s?= =?UTF-8?q?=20for=20missing=20hashed=20assets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nginx was rewriting missing `/assets/*` files to `index.html`, so requests for stale chunks got a 200 with the SPA shell served as a JS module. That is what turned a plain 404 into the confusing: "TypeError: error loading dynamically imported module" whenever a client loaded before a deployment requested an old chunk. Stop rewriting missing `/assets/*` to `index.html`: those requests now return a real 404 with `Cache-Control: no-store`. SPA route fallback for non-asset paths is unchanged. --- docker/dinum-frontend/nginx/default.conf | 7 +++++++ src/frontend/default.conf | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/docker/dinum-frontend/nginx/default.conf b/docker/dinum-frontend/nginx/default.conf index c3d26ec6..dcbedb74 100644 --- a/docker/dinum-frontend/nginx/default.conf +++ b/docker/dinum-frontend/nginx/default.conf @@ -74,6 +74,13 @@ server { location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 30d; add_header Cache-Control "public, max-age=2592000"; + try_files $uri =404; + error_page 404 = @asset_missing; + } + + location @asset_missing { + add_header Cache-Control "no-store" always; + return 404; } # Serve static files diff --git a/src/frontend/default.conf b/src/frontend/default.conf index cf83d258..722875ae 100644 --- a/src/frontend/default.conf +++ b/src/frontend/default.conf @@ -14,6 +14,13 @@ server { location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires 30d; add_header Cache-Control "public, max-age=2592000"; + try_files $uri =404; + error_page 404 = @asset_missing; + } + + location @asset_missing { + add_header Cache-Control "no-store" always; + return 404; } # Serve static files