public function getHttpHost()
    {
        if (isset($_SERVER['HTTP_HOST'])
            && isset($_SERVER['SERVER_NAME'])
            && $_SERVER['HTTP_HOST'] === $_SERVER['SERVER_NAME']
        ) {
            return $_SERVER['HTTP_HOST'];
        }

        if (isset($_SERVER['HTTP_HOST'])) {
            return $_SERVER['HTTP_HOST'];
        }

        // This is the least reliable, due to the ability to spoof it
        if (isset($_SERVER['SERVER_NAME'])) {
            return $_SERVER['SERVER_NAME'];
        }

        return null;
    }