public function handleSslRouting()
    {
        if ($this->settings->sslRoutingEnabled && !Craft::$app->getRequest()->getIsConsoleRequest())
        {
            $requestedUrl   = Craft::$app->request->getUrl();
            $restrictedUrls = $this->settings->sslRoutingRestrictedUrls;

            if (!Craft::$app->request->isSecureConnection)
            {
                foreach ($restrictedUrls as $restrictedUrl)
                {
                    // Parse dynamic variables like /{cpTrigger}
                    if (stripos($restrictedUrl, '{') !== false)
                    {
                        $restrictedUrl = Craft::$app->view->renderObjectTemplate(
                            $restrictedUrl,
                            $this->getDynamicParams()
                        );
                    }

                    $restrictedUrl = '/'.ltrim($restrictedUrl, '/');

                    if (stripos($requestedUrl, $restrictedUrl) === 0)
                    {
                        $this->forceSsl();
                    }
                }

                return true;
            }
        }

        return false;
    }
public function handleSslRouting()
    {
        if ($this->settings->sslRoutingEnabled && !Craft::$app->getRequest()->getIsConsoleRequest())
        {
            $requestedUrl   = Craft::$app->request->getUrl();
            $restrictedUrls = $this->settings->sslRoutingRestrictedUrls;

            if (!Craft::$app->request->isSecureConnection)
            {
                foreach ($restrictedUrls as $restrictedUrl)
                {
                    // Parse dynamic variables like /{cpTrigger}
                    if (stripos($restrictedUrl, '{') !== false)
                    {
                        $restrictedUrl = Craft::$app->view->renderObjectTemplate(
                            $restrictedUrl,
                            $this->getDynamicParams()
                        );
                    }

                    $restrictedUrl = '/'.ltrim($restrictedUrl, '/');

                    if (stripos($requestedUrl, $restrictedUrl) === 0)
                    {
                        $this->forceSsl();
                    }
                }

                return true;
            }
        }

        return false;
    }
public function handleSslRouting ( ) { if ( $ this -> settings -> sslRoutingEnabled && ! Craft :: $ app -> getRequest ( ) -> getIsConsoleRequest ( ) ) { $ requestedUrl = Craft :: $ app -> request -> getUrl ( ) ; $ restrictedUrls = $ this -> settings -> sslRoutingRestrictedUrls ; if ( ! Craft :: $ app -> request -> isSecureConnection ) { foreach ( $ restrictedUrls as $ restrictedUrl ) { // Parse dynamic variables like /{cpTrigger} if ( stripos ( $ restrictedUrl , '{' ) !== false ) { $ restrictedUrl = Craft :: $ app -> view -> renderObjectTemplate ( $ restrictedUrl , $ this -> getDynamicParams ( ) ) ; } $ restrictedUrl = '/' . ltrim ( $ restrictedUrl , '/' ) ; if ( stripos ( $ requestedUrl , $ restrictedUrl ) === 0 ) { $ this -> forceSsl ( ) ; } } return true ; } } return false ; }
Forces SSL based on restricted URLs
The environment settings take priority over those defined in the control panel

@return bool

@throws ErrorException
@throws \yii\base\Exception
@throws \yii\base\InvalidConfigException
Forces SSL based on restricted URLs The environment settings take priority over those defined in the control panel