diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 693358c9545c..e24787c524a3 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -338,6 +338,7 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon $this->getRequestObject(); $this->getResponseObject(); + $this->forceSecureAccess(); Events::trigger('pre_system'); @@ -354,8 +355,6 @@ public function run(?RouteCollectionInterface $routes = null, bool $returnRespon $this->response = $possibleResponse; } else { try { - $this->forceSecureAccess(); - $this->response = $this->handleRequest($routes, config(Cache::class), $returnResponse); } catch (ResponsableInterface|DeprecatedRedirectException $e) { $this->outputBufferingEnd();