Merge pull request 'fix(web-ui): CSS must-revalidate so deploys aren't masked by browser cache' (#22) from fix/css-cache-revalidate into main
This commit is contained in:
commit
674dccca4e
1 changed files with 7 additions and 6 deletions
|
|
@ -18,16 +18,17 @@ server {
|
||||||
# Root location - serve static files
|
# Root location - serve static files
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
# Cache static assets aggressively
|
# Fonts, icons, images: rarely change, safe to cache aggressively.
|
||||||
location ~* \.(css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
location ~* \.(png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||||
expires 1y;
|
expires 1y;
|
||||||
add_header Cache-Control "public, immutable";
|
add_header Cache-Control "public, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
# JS files — must revalidate so a redeploy is picked up immediately.
|
# CSS / JS — must revalidate so a redeploy is picked up immediately.
|
||||||
# The static index.html links api.js with a ?v=N query string anyway,
|
# The index.html links these without a version query string, so without
|
||||||
# but defence-in-depth: never let a stale .js sit in a browser cache.
|
# this rule a stale stylesheet/script sits in the browser cache forever
|
||||||
location ~* \.js$ {
|
# (which produced the unstyled calendar that triggered this fix).
|
||||||
|
location ~* \.(css|js)$ {
|
||||||
expires -1;
|
expires -1;
|
||||||
add_header Cache-Control "no-cache, must-revalidate";
|
add_header Cache-Control "no-cache, must-revalidate";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue