diff --git a/helpers/utils.php b/helpers/utils.php index 2fbe3ff..86d64d3 100644 --- a/helpers/utils.php +++ b/helpers/utils.php @@ -116,6 +116,10 @@ */ public static function getBaseUrl() { $proto = (!isset($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] == "" || $_SERVER["HTTPS"] == "off") ? "http://" : "https://"; + // Check if we are behind an https proxy + if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') { + $proto = 'https://'; + } $host = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : ""; if (realpath($_SERVER["SCRIPT_FILENAME"])) { $scriptPath = substr(dirname(realpath($_SERVER["SCRIPT_FILENAME"])), strlen(ROOT_DIR)); @@ -188,4 +192,4 @@ } -?> \ No newline at end of file +?>