public function getCorsOrigin($url = null) {
        if (is_null($url)) {
            $baseUrl = Mage::getBaseUrl();
        } else {
            $baseUrl = $url;
        }
        $path = parse_url($baseUrl, PHP_URL_PATH);
        $domain = parse_url($baseUrl, PHP_URL_HOST);
        // there has to be a better way to just strip the path off
        return substr($baseUrl, 0,
            strpos($baseUrl, $path,
                strpos($baseUrl, $domain)));
    }