Use no-store for docs: epoch mtimes make revalidation serve stale

This commit is contained in:
Berwn
2026-06-18 12:24:38 +07:00
parent 77a18df257
commit d1b24017aa
+6 -5
View File
@@ -30,11 +30,12 @@ in
enable = true; enable = true;
virtualHosts.":${toString port}".extraConfig = '' virtualHosts.":${toString port}".extraConfig = ''
root * ${site} root * ${site}
# mdBook doesn't fingerprint asset filenames, so a browser left to its own # mdBook doesn't fingerprint asset filenames, and every file in the Nix
# heuristics caches the HTML and serves stale docs after a redeploy. Force a # store carries an epoch (1970) mtime, so file_server's only validator never
# conditional request on every load; file_server's ETag/Last-Modified makes # changes across redeploys conditional requests would 304 forever and pin
# the unchanged case a cheap 304 over the mesh. # browsers to stale docs. no-store sidesteps caching entirely; pages are tiny
header Cache-Control "no-cache" # and mesh-only, so refetching on each load is free.
header Cache-Control "no-store"
file_server file_server
''; '';
}; };