mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-31 17:53:40 -04:00
Fixed http to https redirection.
This commit is contained in:
parent
6aa755dca7
commit
74539037da
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.4.3-e",
|
"version": "0.4.3-f",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
@ -32,17 +32,11 @@ module.exports.CreateRedirServer = function (parent, db, args, func) {
|
|||||||
// Perform an HTTP to HTTPS redirection
|
// Perform an HTTP to HTTPS redirection
|
||||||
function performRedirection(req, res) {
|
function performRedirection(req, res) {
|
||||||
var host = req.headers.host;
|
var host = req.headers.host;
|
||||||
if (obj.certificates != null) {
|
if (typeof host == 'string') { host = host.split(":")[0]; }
|
||||||
host = obj.certificates.CommonName;
|
if ((host == null) && (obj.certificates != null)) { host = obj.certificates.CommonName; if (obj.certificates.CommonName.indexOf('.') == -1) { host = req.headers.host; } }
|
||||||
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
|
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);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Return the current domain of the request
|
// Return the current domain of the request
|
||||||
|
Loading…
x
Reference in New Issue
Block a user