]> git.mxchange.org Git - friendica.git/blobdiff - src/App.php
add opensocial as location for db-based execution
[friendica.git] / src / App.php
index 249c9f66ac6c52d1edbed97a5a4237d32235f7b3..db3e644c2fc4391a6716c3cfb184b8b6fe29d694 100644 (file)
@@ -581,6 +581,7 @@ class App
                                // Force SSL redirection
                                if ($this->config->get('system', 'force_ssl') &&
                                        (empty($server['HTTPS']) || $server['HTTPS'] === 'off') &&
+                                       (empty($server['HTTP_X_FORWARDED_PROTO']) || $server['HTTP_X_FORWARDED_PROTO'] === 'http') &&
                                        !empty($server['REQUEST_METHOD']) &&
                                        $server['REQUEST_METHOD'] === 'GET') {
                                        System::externalRedirect($this->baseURL . '/' . $this->args->getQueryString());
@@ -694,6 +695,9 @@ class App
                                $module = $router->getModule();
                        }
 
+                       // Display can change depending on the requested language, so it shouldn't be cached whole
+                       header('Vary: Accept-Language', false);
+
                        // Processes data from GET requests
                        $httpinput = $httpInput->process();
                        $input     = array_merge($httpinput['variables'], $httpinput['files'], $request ?? $_REQUEST);
@@ -702,11 +706,13 @@ class App
                        $timestamp = microtime(true);
                        $response = $module->run($httpException, $input);
                        $this->profiler->set(microtime(true) - $timestamp, 'content');
+
+                       // Wrapping HTML responses in the theme template
                        if ($response->getHeaderLine(ICanCreateResponses::X_HEADER) === ICanCreateResponses::TYPE_HTML) {
-                               $page->run($this, $this->baseURL, $this->args, $this->mode, $response, $this->l10n, $this->profiler, $this->config, $pconfig, $nav, $this->session->getLocalUserId());
-                       } else {
-                               $page->exit($response);
+                               $response = $page->run($this, $this->baseURL, $this->args, $this->mode, $response, $this->l10n, $this->profiler, $this->config, $pconfig, $nav, $this->session->getLocalUserId());
                        }
+
+                       $page->exit($response);
                } catch (HTTPException $e) {
                        $httpException->rawContent($e);
                }