Removed 1h cache, back to etag.

Ylian Saint-Hilaire committed Dec 20, 2019 at 14:50 UTC 2906bb52f36895158c33051e9384890426c989e2
2 files changed +11 -11
package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "meshcentral",
3 - "version": "0.4.6-a",
3 + "version": "0.4.6-c",
4 "keywords": [
5 "Remote Management",
6 "Intel AMT",
webserver.js
+10 -10
@@ -564,14 +564,14 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
564 if (webAuthnKey != null) {
565 // Figure out the origin
566 var httpport = ((args.aliasport != null) ? args.aliasport : args.port);
567 - var origin = "https://" + (domain.dns ? domain.dns : parent.certificates.CommonName);
567 + var origin = 'https://' + (domain.dns ? domain.dns : parent.certificates.CommonName);
568 if (httpport != 443) { origin += ':' + httpport; }
569
570 var assertionExpectations = {
571 challenge: req.session.u2fchallenge,
572 origin: origin,
573 - factor: "either",
574 - fmt: "fido-u2f",
573 + factor: 'either',
574 + fmt: 'fido-u2f',
575 publicKey: webAuthnKey.publicKey,
576 prevCounter: webAuthnKey.counter,
577 userHandle: Buffer.from(user._id, 'binary').toString('base64')
@@ -1924,7 +1924,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
1924 function handleLogoRequest(req, res) {
1925 const domain = checkUserIpAddress(req, res);
1926
1927 - res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day
1927 + //res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day
1928 if ((domain != null) && domain.titlepicture) {
1929 if ((parent.configurationFiles != null) && (parent.configurationFiles[domain.titlepicture] != null)) {
1930 // Use the logo in the database
@@ -2013,7 +2013,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
2013 function handleWelcomeImageRequest(req, res) {
2014 const domain = checkUserIpAddress(req, res);
2015
2016 - res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day
2016 + //res.set({ 'Cache-Control': 'max-age=86400' }); // 1 day
2017 if ((domain != null) && domain.welcomepicture) {
2018 if ((parent.configurationFiles != null) && (parent.configurationFiles[domain.welcomepicture] != null)) {
2019 // Use the welcome image in the database
@@ -3391,7 +3391,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3391 // Add HTTP security headers to all responses
3392 obj.app.use(function (req, res, next) {
3393 parent.debug('webrequest', req.url);
3394 - res.removeHeader("X-Powered-By");
3394 + res.removeHeader('X-Powered-By');
3395 var domain = req.xdomain = getDomain(req);
3396
3397 // If this domain has configured headers, use them.
@@ -3528,8 +3528,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3528 serialtunnel.xdomain = domain;
3529 serialtunnel.xip = req.ip;
3530 ws.on('message', function (b) { serialtunnel.updateBuffer(Buffer.from(b, 'binary')) });
3531 - serialtunnel.forwardwrite = function (b) { ws.send(b, "binary") }
3532 - ws.on("close", function () { serialtunnel.emit('end'); });
3531 + serialtunnel.forwardwrite = function (b) { ws.send(b, 'binary') }
3532 + ws.on('close', function () { serialtunnel.emit('end'); });
3533 obj.parent.mqttbroker.handle(serialtunnel); // Pass socket wrapper to MQTT broker
3534 });
3535 }
@@ -3568,10 +3568,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
3568 //obj.app.get(url + 'stop', function (req, res) { res.send('Stopping Server, <a href="' + url + '">click here to login</a>.'); setTimeout(function () { parent.Stop(); }, 500); });
3569
3570 // Indicates to ExpressJS that the override public folder should be used to serve static files.
3571 - if (obj.parent.webPublicOverridePath != null) { obj.app.use(url, obj.express.static(obj.parent.webPublicOverridePath, { maxAge: '1h' })); }
3571 + if (obj.parent.webPublicOverridePath != null) { obj.app.use(url, obj.express.static(obj.parent.webPublicOverridePath)); }
3572
3573 // Indicates to ExpressJS that the default public folder should be used to serve static files.
3574 - obj.app.use(url, obj.express.static(obj.parent.webPublicPath, { maxAge: '1h' }));
3574 + obj.app.use(url, obj.express.static(obj.parent.webPublicPath));
3575
3576 // Start regular disconnection list flush every 2 minutes.
3577 obj.wsagentsDisconnectionsTimer = setInterval(function () { obj.wsagentsDisconnections = {}; }, 120000);