setHttpHost example

$mailing = $this->getMailing($mailingID);
        if (empty($mailing)) {
            return null;
        }
        $repository = $this->get('models')->getRepository(Shop::class);
        $shop = $repository->getActiveById($mailing['languageID']);
        if ($shop === null) {
            throw new ModelNotFoundException(Shop::class$mailing['languageID']);
        }

        $this->Request()
            ->setHttpHost((string) $shop->getHost())
            ->setBasePath($shop->getBasePath())
            ->setBaseUrl($shop->getBasePath());

        $this->get(ShopRegistrationServiceInterface::class)->registerShop($shop);

        Shopware()->Session()->set('sUserGroup', $mailing['customergroup']);
        $sql = 'SELECT * FROM s_core_customergroups WHERE groupkey=?';
        Shopware()->Session()->set('sUserGroupData', Shopware()->Db()->fetchRow($sql[$mailing['customergroup']]));

        Shopware()->Container()->get(RouterInterface::class)->setGlobalParam('module', 'frontend');
        Shopware()->Config()->offsetSet('DontAttachSession', true);
        
$host = $request->getHeader('X_FORWARDED_HOST');
        if ($host !== null && $host === $shop->getHost()) {
            // If the base path is null, set it to empty string. Otherwise the request will try to assemble the base path. On a reverse proxy setup with varnish this will fail on virtual URLs like /en             // The X-Forwarded-Host header is only set in such environments             if ($shop->getBasePath() === null) {
                $shop->setBasePath('');
            }

            $request->setSecure($shop->getSecure());
            $request->setBasePath($shop->getBasePath());
            $request->setBaseUrl($shop->getBaseUrl());
            $request->setHttpHost($shop->getHost());
        }

        $this->validateShop($shop);
        $this->get(ShopRegistrationServiceInterface::class)->registerShop($shop);
    }

    /** * @return void */
    public function onRouteShutdown(Enlight_Controller_EventArgs $args)
    {
        
Home | Imprint | This part of the site doesn't use cookies.