mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 19:11:51 +00:00
Fixed http to https redirection.
This commit is contained in:
parent
1c7c46b89a
commit
92e7a065de
3 changed files with 4 additions and 10 deletions
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…
Reference in a new issue