From cc65fc7e690f52a48464c63bfeef059019dbbf44 Mon Sep 17 00:00:00 2001 From: IsaiDiaz Date: Wed, 2 Jul 2025 09:29:27 -0400 Subject: [PATCH] processing HTTP_HOST to update SERVER_NAME and SERVER_PORT in .server_info --- workflow/engine/methods/login/authentication.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/workflow/engine/methods/login/authentication.php b/workflow/engine/methods/login/authentication.php index 929857d9c..6ad48069f 100644 --- a/workflow/engine/methods/login/authentication.php +++ b/workflow/engine/methods/login/authentication.php @@ -308,6 +308,22 @@ try { $_CSERVER = $_SERVER; unset($_CSERVER['REQUEST_TIME']); unset($_CSERVER['REMOTE_PORT']); + if (!empty($_SERVER['HTTP_HOST'])) { + $hostParts = explode(':', $_SERVER['HTTP_HOST']); + + $host = $hostParts[0]; + + if (isset($hostParts[1]) && is_numeric($hostParts[1])) { + $port = (int)$hostParts[1]; + } + } else { + $host = $_SERVER['SERVER_NAME'] ?? 'localhost'; + $port = $_SERVER['SERVER_PORT'] ?? 80; + } + + $_CSERVER['SERVER_PORT'] = (string)$port; + $_CSERVER['SERVER_NAME'] = (string)$host; + $cput = serialize($_CSERVER); if (!is_file(PATH_DATA_SITE . '.server_info')) { file_put_contents(PATH_DATA_SITE . '.server_info', $cput);