move cache control to be the first middleware
This commit is contained in:
parent
b48245e870
commit
302113baee
15
src/index.js
15
src/index.js
@ -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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user