summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-22 14:00:51 +0100
committerTor Andersson <tor@ccxvii.net>2023-12-23 02:10:40 +0100
commit5bafe0865f518e4926fc41fec21064e894367fdb (patch)
tree53909d1147ed8bb2d43b66f86ad5c491c15ab974
parent56a7fa727280adcca16fd8460249d2dd49031689 (diff)
downloadserver-5bafe0865f518e4926fc41fec21064e894367fdb.tar.gz
Tweak Cache-Control behavior. Add experimental /clear-cache page.
-rw-r--r--server.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/server.js b/server.js
index 5521c53..ba0de61 100644
--- a/server.js
+++ b/server.js
@@ -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 })
})