diff --git a/client/service-worker.js b/client/service-worker.js index 261550cc..94aa49dd 100644 --- a/client/service-worker.js +++ b/client/service-worker.js @@ -41,7 +41,8 @@ self.addEventListener("fetch", function(event) { function networkOrCache(uri) { return caches.open("thelounge").then(function(cache) { - return fetch(uri) + // Despite the "no-cache" name, it is a conditional request if proper headers are set + return fetch(uri, {cache: "no-cache"}) .then(function(response) { if (response.ok) { return cache.put(uri, response.clone()).then(function() { diff --git a/src/server.js b/src/server.js index 1bfb60ba..a8abbf90 100644 --- a/src/server.js +++ b/src/server.js @@ -39,15 +39,17 @@ module.exports = function() { (Node.js ${colors.green(process.versions.node)} on ${colors.green(process.platform)} ${process.arch})`); log.info(`Configuration file: ${colors.green(Helper.getConfigPath())}`); + const staticOptions = { + redirect: false, + maxAge: 86400 * 1000, + }; + const app = express() .disable("x-powered-by") .use(allRequests) .use(index) - .use(express.static("public")) - .use("/storage/", express.static(Helper.getStoragePath(), { - redirect: false, - maxAge: 86400 * 1000, - })); + .use(express.static(path.join(__dirname, "..", "public"), staticOptions)) + .use("/storage/", express.static(Helper.getStoragePath(), staticOptions)); // This route serves *installed themes only*. Local themes are served directly // from the `public/themes/` folder as static assets, without entering this