This commit is contained in:
Dobromir Popov
2024-02-26 01:05:50 +02:00
parent f4e3d9cc2e
commit 9de291fc0c

View File

@ -75,12 +75,13 @@ app
server.use((req, res, next) => { server.use((req, res, next) => {
req.headers['x-forwarded-host'] = req.headers['x-forwarded-host'] || req.headers.host; req.headers['x-forwarded-host'] = req.headers['x-forwarded-host'] || req.headers.host;
// --------------- // ---------------
if (!baseUrlGloball) { if (!baseUrlGlobal) {
const protocol = req.headers['x-forwarded-proto'] || 'http'; const protocol = req.headers['x-forwarded-proto'] || 'http';
const host = req.headers.host; const host = req.headers.host;
const baseUrl = `${protocol}://${host}`; const baseUrl = `${protocol}://${host}`;
baseUrlGlobal = baseUrl; baseUrlGlobal = baseUrl;
fs.writeFileSync(path.join(__dirname, 'baseUrl.txt'), baseUrlGlobal, 'utf8'); fs.writeFileSync(path.join(__dirname, 'baseUrl.txt'), baseUrlGlobal, 'utf8');
console.log("baseUrlGlobal set to: " + baseUrlGlobal);
} }
next(); next();
}); });