From 6db0ff19f7910b7eb343312be6de3b6af1ea2918 Mon Sep 17 00:00:00 2001
From: Oliver Thiele <mail@oliver-thiele.de>
Date: Tue, 28 Nov 2017 10:34:17 +0100
Subject: [PATCH] [BUGFIX] Also show port when trustedHosts pattern mismatches

Add the port information to the error message when the
trustedHostsPattern mismatches. This is important as
the SERVER_NAME may match, but the SERVER_PORT might be
different from the default ports.

Releases: master, 8.7
Resolves: #83133
Change-Id: I8a25cc0bd2c9578b611986cea4bb7f270dff927b
Reviewed-on: https://review.typo3.org/54821
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
---
 .../install/Classes/SystemEnvironment/SetupCheck.php       | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php b/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php
index 0c0201e2ccfd..62dc1e24bed1 100644
--- a/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php
+++ b/typo3/sysext/install/Classes/SystemEnvironment/SetupCheck.php
@@ -74,10 +74,11 @@ class SetupCheck implements CheckInterface
                     'Trusted hosts pattern is configured to allow current host value.'
                 ));
             } else {
+                $defaultPort = GeneralUtility::getIndpEnv('TYPO3_SSL') ? '443' : '80';
                 $this->messageQueue->enqueue(new FlashMessage(
-                    'The trusted hosts pattern will be configured to allow all header values. This is because your $SERVER_NAME'
-                        . ' is "' . htmlspecialchars($_SERVER['SERVER_NAME']) . '" while your HTTP_HOST is "'
-                        . htmlspecialchars($_SERVER['HTTP_HOST']) . '". Check the pattern defined in Install Tool -> All'
+                    'The trusted hosts pattern will be configured to allow all header values. This is because your $SERVER_NAME:[defaultPort]'
+                        . ' is "' . $_SERVER['SERVER_NAME'] . ':' . $defaultPort . '" while your HTTP_HOST:SERVER_PORT is "'
+                        . $_SERVER['HTTP_HOST'] . ':' . $_SERVER['SERVER_PORT'] . '". Check the pattern defined in Install Tool -> All'
                         . ' configuration -> System -> trustedHostsPattern and adapt it to expected host value(s).',
                     'Trusted hosts pattern mismatch',
                     FlashMessage::ERROR
-- 
GitLab