diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-22 14:00:51 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-12-23 02:10:40 +0100 |
commit | 5bafe0865f518e4926fc41fec21064e894367fdb (patch) | |
tree | 53909d1147ed8bb2d43b66f86ad5c491c15ab974 | |
parent | 56a7fa727280adcca16fd8460249d2dd49031689 (diff) | |
download | server-5bafe0865f518e4926fc41fec21064e894367fdb.tar.gz |
Tweak Cache-Control behavior. Add experimental /clear-cache page.
-rw-r--r-- | server.js | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -160,9 +160,9 @@ function login_delete(res, sid) { function set_static_headers(res, path) { if (path.match(/\.(jpg|png|svg|webp|ico|woff2)$/)) - res.setHeader("Cache-Control", "max-age=86400") + res.setHeader("Cache-Control", "max-age=86400, must-revalidate") else - res.setHeader("Cache-Control", "max-age=60") + res.setHeader("Cache-Control", "no-cache") } let app = express() @@ -385,6 +385,11 @@ app.get('/', function (req, res) { res.render('index.pug', { user: req.user }) }) +app.get("/clear-cache", function (req, res) { + res.setHeader("Clear-Site-Data", `"cache"`) + res.send("Did it work?") +}) + app.get('/create', function (req, res) { res.render('create-index.pug', { user: req.user }) }) |