Minimise the number of headers the server is sending

This commit is contained in:
Holly Stubbs 2022-02-22 09:01:19 +00:00
parent 919e0b6701
commit acf767c71e
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -357,13 +357,16 @@ module.exports = async function(req, res) {
} catch (e) {
console.error(e);
} finally {
// Send the prepared packet to the client
// Only send the headers that we absolutely have to
res.removeHeader('X-Powered-By');
res.removeHeader('Date');
res.writeHead(200, {
"cho-protocol": global.protocolVersion,
// Nice to have
"Connection": "keep-alive",
"Keep-Alive": "timeout=5, max=100",
"Content-Type": "text/html; charset=UTF-8"
});
// Send the prepared packet(s) to the client
res.end(responseData);
}
}