public static function fixSchemeProxyFromGlobals(array $globals = null) : array
    {
        $globals = $globals === null ? $_SERVER : $globals;
        if (!empty($globals['HTTPS']) && strtolower($globals['HTTPS']) !== 'off'
            // hide behind proxy / maybe cloud flare cdn
            || isset($globals['HTTP_X_FORWARDED_PROTO']) && $globals['HTTP_X_FORWARDED_PROTO'] === 'https'
            || !empty($globals['HTTP_FRONT_END_HTTPS']) && strtolower($globals['HTTP_FRONT_END_HTTPS']) !== 'off'
        ) {
            // fixing HTTPS Environment
            $globals['HTTPS'] = 'on';
        }

        return $globals;
    }