var mime = require('mime-types') var serveStatic = require('serve-static') app.use(serveStatic(__dirname + '/public', { maxAge: '1y', setHeaders: function (res, path) { if (mime.lookup(path) === 'text/html') { res.setHeader('Cache-Control', 'public, max-age=0') } } }))
app.use(function (req, res, next) { console.log(req.url); if (req.url !== '/app/index.html') { res.header('Cache-Control', 'public, max-age=600s') } next(); }); app.use('/app', express.static(path.resolve(__dirname, './app')));
References
https://stackoverflow.com/questions/45076710/can-i-ignore-few-static-files-in-express-static
https://github.com/expressjs/serve-static/issues/32