mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
Fixed x-forwarded-host where multiple hosts are specified.
This commit is contained in:
parent
bbb9014fcd
commit
f791515546
2 changed files with 2 additions and 3 deletions
|
@ -1623,8 +1623,7 @@ function CreateMeshCentralServer(config, args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup and start the legacy swarm server
|
// Setup and start the legacy swarm server
|
||||||
if ((obj.certificates.swarmserver != null) && (obj.args.swarmport !== 0)) {
|
if ((obj.certificates.swarmserver != null) && (obj.args.swarmport != null) && (obj.args.swarmport !== 0)) {
|
||||||
if (obj.args.swarmport == null) { obj.args.swarmport = 8080; }
|
|
||||||
obj.swarmserver = require('./swarmserver.js').CreateSwarmServer(obj, obj.db, obj.args, obj.certificates);
|
obj.swarmserver = require('./swarmserver.js').CreateSwarmServer(obj, obj.db, obj.args, obj.certificates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5716,7 +5716,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
|
||||||
if (clientIpSplit.length == 2) { req.clientIp = clientIpSplit[0]; }
|
if (clientIpSplit.length == 2) { req.clientIp = clientIpSplit[0]; }
|
||||||
|
|
||||||
// Get server host
|
// Get server host
|
||||||
if (req.headers['x-forwarded-host']) { xforwardedhost = req.headers['x-forwarded-host']; }
|
if (req.headers['x-forwarded-host']) { xforwardedhost = req.headers['x-forwarded-host'].split(',')[0]; } // If multiple hosts are specified with a comma, take the first one.
|
||||||
} else {
|
} else {
|
||||||
req.clientIp = ipex;
|
req.clientIp = ipex;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue