feat(assist): tried to add a custom header to all responses

This commit is contained in:
Alexander 2025-03-21 11:33:58 +01:00
parent 5cceea06ce
commit 3e82da1a26

View file

@ -84,30 +84,30 @@ const createSocketIOServer = function (server, prefix) {
if (io) {
return io;
}
// Common options for both initialization methods
const options = {
maxHttpBufferSize: (parseFloat(process.env.maxHttpBufferSize) || 5) * 1e6,
cors: {
origin: "*",
methods: ["GET", "POST", "PUT"],
credentials: true
},
path: (prefix ? prefix : '') + '/socket',
allowRequest: (req, callback) => {
req.res.setHeader('x-host-id', process.env.HOSTNAME || 'unknown');
callback(null, true);
},
...getCompressionConfig()
};
if (process.env.uws !== "true") {
io = _io(server, {
maxHttpBufferSize: (parseFloat(process.env.maxHttpBufferSize) || 5) * 1e6,
cors: {
origin: "*",
methods: ["GET", "POST", "PUT"],
credentials: true
},
path: (prefix ? prefix : '') + '/socket',
...getCompressionConfig()
});
io = _io(server, options);
} else {
io = new _io.Server({
maxHttpBufferSize: (parseFloat(process.env.maxHttpBufferSize) || 5) * 1e6,
cors: {
origin: "*",
methods: ["GET", "POST", "PUT"],
credentials: true
},
path: (prefix ? prefix : '') + '/socket',
...getCompressionConfig()
});
io = new _io.Server(options);
io.attachApp(server);
}
if (useRedis) {
startCacheRefresher();
}