performance: maxAge for favicon and plugin definitions (#4761)

pull/4770/head
John McLear 2021-02-13 08:13:48 +00:00 committed by GitHub
parent 09e9c36098
commit 483f4344c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -83,7 +83,7 @@ exports.expressCreateServer = (hookName, args, cb) => {
settings.skinName,
'favicon.ico'
);
res.setHeader('Cache-Control', `public, max-age=${settings.maxAge}`);
res.sendFile(filePath, (err) => {
// there is no custom favicon, send the default favicon
if (err) {

View File

@ -65,7 +65,8 @@ exports.expressCreateServer = async (hookName, args) => {
clientPlugins[name] = {...plugins.plugins[name]};
delete clientPlugins[name].package;
}
res.header('Content-Type', 'application/json; charset=utf-8');
res.setHeader('Content-Type', 'application/json; charset=utf-8');
res.setHeader('Cache-Control', `public, max-age=${settings.maxAge}`);
res.write(JSON.stringify({plugins: clientPlugins, parts: clientParts}));
res.end();
});