diff --git a/workflow/engine/src/ProcessMaker/Core/System.php b/workflow/engine/src/ProcessMaker/Core/System.php index 1361ed6a9..a85c6f1e6 100644 --- a/workflow/engine/src/ProcessMaker/Core/System.php +++ b/workflow/engine/src/ProcessMaker/Core/System.php @@ -1630,10 +1630,11 @@ class System public static function getServerHostname() { $host = ""; - if (!empty($_SERVER['SERVER_NAME'])) { - $host = $_SERVER['SERVER_NAME']; - } else if (defined('SERVER_NAME')) { + if (defined('SERVER_NAME')) { $host = SERVER_NAME; + } else { + $hostParts = explode(':', $_SERVER['HTTP_HOST'] ?? ''); + $host = isset($hostParts[0]) ? $hostParts[0] : $_SERVER['SERVER_NAME']; } return $host; } diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 7f288c059..dbfadb872 100644 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -447,11 +447,11 @@ define('PATH_DATA_REPORTS', PATH_DATA_SITE . 'reports/'); define('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/'); define('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP); define('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP); -define('SERVER_NAME', $_SERVER['SERVER_NAME']); $hostParts = explode(':', $_SERVER['HTTP_HOST'] ?? ''); $port = isset($hostParts[1]) && is_numeric($hostParts[1]) ? (int)$hostParts[1] : $_SERVER['SERVER_PORT']; - +$host = isset($hostParts[0]) ? $hostParts[0] : $_SERVER['SERVER_NAME']; +define('SERVER_NAME', $host); define('SERVER_PORT', $port); // create memcached singleton