public static function isHttps()
    {
        // Default is http scheme.
        $https = false;

        if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
            // $_SERVER['HTTPS'] is NOT set behind a proxy / load balancer
            $https = true;
        } elseif (
            // $_SERVER['HTTPS'] is set behind a proxy / load balancer
            !empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ||
            !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {
            $https = true;
        }
        return $https;
    }