diff --git a/modules/docs.nix b/modules/docs.nix index c9ab38d..377d35f 100644 --- a/modules/docs.nix +++ b/modules/docs.nix @@ -30,6 +30,11 @@ in enable = true; virtualHosts.":${toString port}".extraConfig = '' root * ${site} + # mdBook doesn't fingerprint asset filenames, so a browser left to its own + # heuristics caches the HTML and serves stale docs after a redeploy. Force a + # conditional request on every load; file_server's ETag/Last-Modified makes + # the unchanged case a cheap 304 over the mesh. + header Cache-Control "no-cache" file_server ''; };