src/Control/Middleware/CanonicalURLMiddleware.php
protected function requiresSSL(HTTPRequest $request)
    {
        // Check if force SSL is enabled
        if (!$this->getForceSSL()) {
            return false;
        }

        // Already on SSL
        if ($request->getScheme() === 'https') {
            return false;
        }

        // Veto if any existing patterns fail
        $patterns = $this->getForceSSLPatterns();
        if (!$patterns) {
            return true;
        }

        // Filter redirect based on url
        $relativeURL = $request->getURL(true);
        foreach ($patterns as $pattern) {
            if (preg_match($pattern, $relativeURL)) {
                return true;
            }
        }

        // No patterns match
        return false;
    }
protected function requiresSSL(HTTPRequest $request)
    {
        // Check if force SSL is enabled
        if (!$this->getForceSSL()) {
            return false;
        }

        // Already on SSL
        if ($request->getScheme() === 'https') {
            return false;
        }

        // Veto if any existing patterns fail
        $patterns = $this->getForceSSLPatterns();
        if (!$patterns) {
            return true;
        }

        // Filter redirect based on url
        $relativeURL = $request->getURL(true);
        foreach ($patterns as $pattern) {
            if (preg_match($pattern, $relativeURL)) {
                return true;
            }
        }

        // No patterns match
        return false;
    }
protected function requiresSSL ( HTTPRequest $ request ) { // Check if force SSL is enabled if ( ! $ this -> getForceSSL ( ) ) { return false ; } // Already on SSL if ( $ request -> getScheme ( ) === 'https' ) { return false ; } // Veto if any existing patterns fail $ patterns = $ this -> getForceSSLPatterns ( ) ; if ( ! $ patterns ) { return true ; } // Filter redirect based on url $ relativeURL = $ request -> getURL ( true ) ; foreach ( $ patterns as $ pattern ) { if ( preg_match ( $ pattern , $ relativeURL ) ) { return true ; } } // No patterns match return false ; }
Check if a redirect for SSL is necessary

@param HTTPRequest $request
@return bool
Check if a redirect for SSL is necessary