// 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());
$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);
$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);
}