From 4c4c7b526d68bdcff891d7bfb6494a4ab1ba1383 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sat, 13 Feb 2021 07:35:25 +0000 Subject: [PATCH] performance: i18n maxage (#4759) --- src/node/hooks/i18n.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node/hooks/i18n.js b/src/node/hooks/i18n.js index 5b4b0ec12..31848b484 100644 --- a/src/node/hooks/i18n.js +++ b/src/node/hooks/i18n.js @@ -109,6 +109,7 @@ exports.expressCreateServer = (n, args, cb) => { // works with /locale/en and /locale/en.json requests const locale = req.params.locale.split('.')[0]; if (exports.availableLangs.hasOwnProperty(locale)) { + res.setHeader('Cache-Control', `public, max-age=${settings.maxAge}`); res.setHeader('Content-Type', 'application/json; charset=utf-8'); res.send(`{"${locale}":${JSON.stringify(locales[locale])}}`); } else { @@ -117,6 +118,7 @@ exports.expressCreateServer = (n, args, cb) => { }); args.app.get('/locales.json', (req, res) => { + res.setHeader('Cache-Control', `public, max-age=${settings.maxAge}`); res.setHeader('Content-Type', 'application/json; charset=utf-8'); res.send(localeIndex); });