]> git.mxchange.org Git - friendica.git/commitdiff
Move force_ssl behavior
authorPhilipp <admin@philipp.info>
Sat, 18 Feb 2023 19:47:52 +0000 (20:47 +0100)
committerPhilipp <admin@philipp.info>
Sat, 18 Feb 2023 20:12:20 +0000 (21:12 +0100)
index.php
src/App.php

index 34952afcb0bfc0ef8f3d161e8bff1ca0eb413b2e..90df9c00e9b77d56d3a1d192836fc48ff772ddad 100644 (file)
--- a/index.php
+++ b/index.php
@@ -48,5 +48,6 @@ $a->runFrontend(
        $dice->create(\Friendica\Content\Nav::class),
        $dice->create(Friendica\Module\Special\HTTPException::class),
        new \Friendica\Util\HTTPInputData($_SERVER),
-       $start_time
+       $start_time,
+       $_SERVER
 );
index 9df62a4e776bdb49be18ec5e682cd2156364d5f9..792df0f74832752ec52a8419974cd2c018959412 100644 (file)
@@ -555,11 +555,12 @@ class App
         * @param ModuleHTTPException         $httpException The possible HTTP Exception container
         * @param HTTPInputData               $httpInput  A library for processing PHP input streams
         * @param float                       $start_time The start time of the overall script execution
+        * @param array                       $server     The $_SERVER array
         *
         * @throws HTTPException\InternalServerErrorException
         * @throws \ImagickException
         */
-       public function runFrontend(App\Router $router, IManagePersonalConfigValues $pconfig, Authentication $auth, App\Page $page, Nav $nav, ModuleHTTPException $httpException, HTTPInputData $httpInput, float $start_time)
+       public function runFrontend(App\Router $router, IManagePersonalConfigValues $pconfig, Authentication $auth, App\Page $page, Nav $nav, ModuleHTTPException $httpException, HTTPInputData $httpInput, float $start_time, array $server)
        {
                $this->profiler->set($start_time, 'start');
                $this->profiler->set(microtime(true), 'classinit');
@@ -575,10 +576,12 @@ class App
 
                        if (!$this->mode->isInstall()) {
                                // Force SSL redirection
-                               if ($this->baseURL->checkRedirectHttps()) {
-                                       System::externalRedirect($this->baseURL->get() . '/' . $this->args->getQueryString());
+                               if ($this->config->get('system', 'force_ssl') &&
+                                       (empty($server['HTTPS']) || $server['HTTPS'] === 'off') &&
+                                       !empty($server['REQUEST_METHOD']) &&
+                                       $server['REQUEST_METHOD'] === 'GET') {
+                                       System::externalRedirect($this->baseURL . '/' . $this->args->getQueryString());
                                }
-
                                Core\Hook::callAll('init_1');
                        }