Fix Base URL selftest with Reverse Proxy (#7352)

This commit is contained in:
Yuriy Bakhtin 2024-12-18 15:52:29 +01:00 committed by GitHub
parent 1738937102
commit 6cc87f4d34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -431,13 +431,13 @@ class SelfTest
$title = Yii::t('AdminModule.information', 'Settings') . ' - ' . Yii::t('AdminModule.information', 'Base URL');
$scheme = Yii::$app->request->getIsSecureConnection() ? 'https' : 'http';
$port = Yii::$app->request->getServerPort();
$currentBaseUrl = $scheme . '://' . preg_replace('/:\d+$/', '', $_SERVER['HTTP_HOST'])
. (
($scheme === 'https' && $_SERVER['SERVER_PORT'] == 443) ||
($scheme === 'http' && $_SERVER['SERVER_PORT'] == 80)
($scheme === 'https' && $port == 443) ||
($scheme === 'http' && $port == 80)
? ''
: ':' . $_SERVER['SERVER_PORT']
: ':' . $port
)
. ($_SERVER['BASE'] ?? '');
if ($currentBaseUrl === Yii::$app->settings->get('baseUrl')) {