diff --git a/gulliver/methods/errors/block.php b/gulliver/methods/errors/block.php index 5281ce1a3..19e20213e 100644 --- a/gulliver/methods/errors/block.php +++ b/gulliver/methods/errors/block.php @@ -4,7 +4,8 @@ if (function_exists("http_response_code")) { } $http = G::is_https() ? "https" : "http"; -$host = $_SERVER["SERVER_NAME"] . (($_SERVER["SERVER_PORT"] != "80") ? ":" . $_SERVER["SERVER_PORT"] : ""); + +$host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']); $urlLogin = $http . "://" . $host . "/sys/en/lurana/login/login"; $urlHome = $urlLogin; diff --git a/gulliver/methods/errors/error403.php b/gulliver/methods/errors/error403.php index df215336f..a4c25b831 100644 --- a/gulliver/methods/errors/error403.php +++ b/gulliver/methods/errors/error403.php @@ -1,7 +1,7 @@ options['name']; $endpoint = sprintf( diff --git a/workflow/engine/src/ProcessMaker/Core/System.php b/workflow/engine/src/ProcessMaker/Core/System.php index 26cf93d85..1361ed6a9 100644 --- a/workflow/engine/src/ProcessMaker/Core/System.php +++ b/workflow/engine/src/ProcessMaker/Core/System.php @@ -1645,10 +1645,8 @@ class System */ public static function getServerPort() { - $port = ""; - if (isset($_SERVER['SERVER_PORT'])) { - $port = $_SERVER['SERVER_PORT']; - } else if (defined('SERVER_PORT')) { + $port = "80"; + if (defined('SERVER_PORT')) { $port = SERVER_PORT; } return $port; diff --git a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php index 873a80a57..8b1b4e737 100644 --- a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php +++ b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php @@ -148,7 +148,7 @@ class Server implements iAuthenticate public function index() { $http = \G::is_https() ? 'https' : 'http'; - $host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); + $host = $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']); $host = $http .'://'. $host; $applicationsLink = sprintf('%s/%s/oauth2/apps', $host, config("system.workspace")); @@ -184,7 +184,7 @@ class Server implements iAuthenticate if (! isset($_SESSION['USER_LOGGED'])) { $http = \G::is_https() ? 'https' : 'http'; - $host = $http . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : ''); + $host = $http . '://' . $_SERVER['HTTP_HOST'] ?? ($_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']); $redirect = urlencode('/'.self::$workspace.$_SERVER['REQUEST_URI']); $loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, config("system.workspace"), SYS_LANG, SYS_SKIN, $redirect); diff --git a/workflow/engine/templates/setup/webServicesTree.php b/workflow/engine/templates/setup/webServicesTree.php index 9a02ea909..2dce30374 100644 --- a/workflow/engine/templates/setup/webServicesTree.php +++ b/workflow/engine/templates/setup/webServicesTree.php @@ -25,7 +25,7 @@ if (isset ($_GET ['x'])) { } } -$defaultEndpoint = 'http://' . $_SERVER ['SERVER_NAME'] . ':' . $_SERVER ['SERVER_PORT'] . '/sys' . config("system.workspace") . '/en/classic/services/wsdl2'; +$defaultEndpoint = 'http://' . $_SERVER ['HTTP_HOST'] . '/sys' . config("system.workspace") . '/en/classic/services/wsdl2'; $wsdl = isset ($_SESSION ['END_POINT']) ? $_SESSION ['END_POINT'] : $defaultEndpoint;