From bea63b07d89b0945002dc6a2dbeb22485a9b6037 Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Sun, 31 Jul 2022 14:10:44 +0700 Subject: [PATCH] fix: no-cache cache-control for static assets when cacheControl is disabled in config this behavior makes more sense, and will then properly rely on our internal conditinal GETs handlers and whatnot --- lolisafe.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lolisafe.js b/lolisafe.js index 55f4e0d..fc5c44a 100644 --- a/lolisafe.js +++ b/lolisafe.js @@ -128,8 +128,10 @@ safe.use(nunjucksRendererInstance.middleware) // and additionally call Cloudflare API to have their CDN caches purged when lolisafe starts const cdnRoutes = [...config.pages] -// Defaults to no-op -let setHeadersForStaticAssets = () => {} +// Defaults to validating cache's validity before using them (soft cache) +let setHeadersForStaticAssets = (req, res) => { + res.header('Cache-Control', 'no-cache') +} // Cache control if (config.cacheControl) {