public function getAllowedHostsRegex() {
        $hosts = array();
        foreach (Mage::app()->getStores() as $store) {
            $hosts[] = parse_url($store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, false), PHP_URL_HOST);
        }

        $hosts = array_values(array_unique($hosts));

        $pattern = '('.implode('|', array_map("preg_quote", $hosts)).')';
        return $pattern;
    }