🐛(frontend) return real 404s for missing hashed assets

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.
This commit is contained in:
lebaudantoine
2026-08-12 19:40:47 +02:00
parent 2af6157265
commit bd51c142f6
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -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
+7
View File
@@ -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