summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
Diffstat (limited to 'server.js')
-rw-r--r--server.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/server.js b/server.js
index 470eba9..a6c8394 100644
--- a/server.js
+++ b/server.js
@@ -87,7 +87,14 @@ io.use(passport_socket.authorize({
store: session_store,
}));
-app.use(express.static('public'));
+const is_immutable = /\.(svg|png|jpg|jpeg|woff2)$/;
+
+function setHeaders(res, path) {
+ if (is_immutable.test(path))
+ res.set("Cache-Control", "public, max-age=86400, immutable");
+}
+
+app.use(express.static('public', { setHeaders: setHeaders }));
/*
* MISC FUNCTIONS