diff --git a/agents/meshagent_freebsd_x86-64 b/agents/meshagent_freebsd_x86-64 index 9e613ec8..7054485c 100644 Binary files a/agents/meshagent_freebsd_x86-64 and b/agents/meshagent_freebsd_x86-64 differ diff --git a/package.json b/package.json index 44b55994..fce418af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.3-e", + "version": "0.4.3-f", "keywords": [ "Remote Management", "Intel AMT", diff --git a/redirserver.js b/redirserver.js index 8fec5263..56fb019d 100644 --- a/redirserver.js +++ b/redirserver.js @@ -32,16 +32,10 @@ module.exports.CreateRedirServer = function (parent, db, args, func) { // Perform an HTTP to HTTPS redirection function performRedirection(req, res) { var host = req.headers.host; - if (obj.certificates != null) { - host = obj.certificates.CommonName; - if (obj.certificates.CommonName.indexOf('.') == -1) { host = req.headers.host; } - } + if (typeof host == 'string') { host = host.split(":")[0]; } + if ((host == null) && (obj.certificates != null)) { host = obj.certificates.CommonName; if (obj.certificates.CommonName.indexOf('.') == -1) { host = req.headers.host; } } var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified - if (req.headers && req.headers.host && (req.headers.host.split(":")[0].toLowerCase() == "localhost")) { - res.redirect("https://localhost:" + httpsPort + req.url); - } else { - res.redirect("https://" + host + ":" + httpsPort + req.url); - } + res.redirect("https://" + host + ":" + httpsPort + req.url); } /*