Public Access
fix(nginx): revalidate index.html and translations on every load
i18n/*.json and index.html keep their names across deploys, so browsers kept old files and showed raw keys like NAV.DASHBOARD. Hashed /assets/ now get a one-year immutable cache.
This commit is contained in:
1 parent
95c1f54f62
commit
4b821b89df
1 file changed
+10
-2
+10
-2
@@ -1,11 +1,19 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
# Vite puts a content hash in these file names, so they never change.
|
||||||
|
location /assets/ {
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
# index.html and /i18n/*.json keep their names across deploys. Without
|
||||||
|
# no-cache the browser shows old translation keys or loads an old bundle.
|
||||||
location / {
|
location / {
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html index.htm;
|
index index.html index.htm;
|
||||||
|
add_header Cache-Control "no-cache";
|
||||||
|
|
||||||
# Handle React Router navigation
|
# Handle React Router navigation
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user