fix: Improve browser caching for public files

This commit is contained in:
Maksim Eltyshev
2025-11-28 13:14:25 +01:00
parent f7a09b2eca
commit 68e5c33418
2 changed files with 17 additions and 1 deletions
+5 -1
View File
@@ -47,7 +47,11 @@ function staticDirServer(prefix, dirFn) {
// Custom config properties are not available when the routes config is
// loaded, so resolve the target value just before serving the request.
const dir = dirFn();
const staticServer = serveStatic(dir, { index: false });
const staticServer = serveStatic(dir, {
index: false,
maxAge: sails.config.http.cache,
immutable: true,
});
const reqPath = req.url;
if (reqPath.startsWith(prefix)) {