Fixed http to https redirection.
Ylian Saint-Hilaire committed
Oct 25, 2019 at 16:32 UTC
92e7a065dee3f61988689a83b5d58f8be39a7d6c
3 files changed
+4
-10
agents/meshagent_freebsd_x86-64
Binary files a/agents/meshagent_freebsd_x86-64 and b/agents/meshagent_freebsd_x86-64 differ
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.4.3-e",
3
+ "version": "0.4.3-f",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
redirserver.js
+3
-9
@@ -32,16 +32,10 @@ module.exports.CreateRedirServer = function (parent, db, args, func) {
32
// Perform an HTTP to HTTPS redirection
33
function performRedirection(req, res) {
34
var host = req.headers.host;
35
- if (obj.certificates != null) {
36
- host = obj.certificates.CommonName;
37
- if (obj.certificates.CommonName.indexOf('.') == -1) { host = req.headers.host; }
38
- }
35
+ if (typeof host == 'string') { host = host.split(":")[0]; }
36
+ if ((host == null) && (obj.certificates != null)) { host = obj.certificates.CommonName; if (obj.certificates.CommonName.indexOf('.') == -1) { host = req.headers.host; } }
37
var httpsPort = ((obj.args.aliasport == null) ? obj.args.port : obj.args.aliasport); // Use HTTPS alias port is specified
40
- if (req.headers && req.headers.host && (req.headers.host.split(":")[0].toLowerCase() == "localhost")) {
41
- res.redirect("https://localhost:" + httpsPort + req.url);
42
- } else {
43
- res.redirect("https://" + host + ":" + httpsPort + req.url);
44
- }
38
+ res.redirect("https://" + host + ":" + httpsPort + req.url);
39
}
40
41
/*