From 7500a99fad02f49946497f9d053d4110ab805040 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Sat, 6 Feb 2021 21:39:02 +0800 Subject: [PATCH] server: prohibit caching of index.html --- server/app.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/app.ts b/server/app.ts index fe8fa7ed..aa50c74e 100644 --- a/server/app.ts +++ b/server/app.ts @@ -53,15 +53,26 @@ if (config.serveAssets !== false) { encoding: 'utf8', }); + // Prohibit caching of index.html as browser can use a fully cached asset + // tree in some cases, which defeats cache busting by asset hashes. + const headers = { + 'Cache-Control': 'no-cache, no-store, must-revalidate', + Pragma: 'no-cache', + Expires: '0', + }; + app.get(`${servedPath}login`, (_req, res) => { + res.set(headers); res.send(html); }); app.get(`${servedPath}register`, (_req, res) => { + res.set(headers); res.send(html); }); app.get(`${servedPath}overview`, (_req, res) => { + res.set(headers); res.send(html); }); } else {