move cache control to be the first middleware

This commit is contained in:
Yuri Tatishchev 2025-06-17 00:22:39 -07:00
parent b48245e870
commit 302113baee
Signed by: CaZzzer
SSH Key Fingerprint: SHA256:sqXB3fe0LMpfH+IeM/vlmxKdso52kssrIJBlwKXVe1U

View File

@ -80,6 +80,14 @@ wss.on('connection', function connection(ws) {
//// Web server //// //// Web server ////
// app settings // app settings
// disable cache globally because it may break things between server restarts,
// since the paths aren't unique
app.use(function (req, res, next) {
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
next();
});
app.use('/', express.static(__dirname)); app.use('/', express.static(__dirname));
app.use(bodyParser.urlencoded({ app.use(bodyParser.urlencoded({
extended: true extended: true
@ -92,13 +100,6 @@ app.use(session({
logged: false logged: false
})); }));
// disable cache globally because it may break things between server restarts,
// since the paths aren't unique
app.use(function (req, res, next) {
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
next();
});
// home page // home page
app.get("/", function (req, res) { app.get("/", function (req, res) {