From 9b68d3c15724976336598c1cd90c93d25595f424 Mon Sep 17 00:00:00 2001 From: szaimen Date: Fri, 24 Jun 2022 00:41:58 +0200 Subject: [PATCH 1/2] improve logging of setdomain Signed-off-by: szaimen --- php/src/Data/ConfigurationManager.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index e8f27a4c..e691c7b7 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -242,6 +242,8 @@ class ConfigurationManager if ($response !== $instanceID) { error_log('The response of the connection attempt to "' . $testUrl . '" was: ' . $response); + error_log('Expected was: ' . $instanceID); + error_log('The error message was: ' . curl_error($ch)); throw new InvalidSettingConfigurationException("Domain does not point to this server or the reverse proxy is not configured correctly. See the mastercontainer logs for more details. ('sudo docker logs -f nextcloud-aio-mastercontainer')"); } From b45466059992de55903b59ef2e8585fb53e9260c Mon Sep 17 00:00:00 2001 From: szaimen Date: Mon, 27 Jun 2022 12:20:17 +0200 Subject: [PATCH 2/2] allow to continue with local ip-address when behind reverse proxy Signed-off-by: szaimen --- php/src/Data/ConfigurationManager.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index e691c7b7..6a24bf9a 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -208,8 +208,16 @@ class ConfigurationManager throw new InvalidSettingConfigurationException("DNS config is not set for this domain or the domain is not a valid domain! (It was found to be set to '" . $dnsRecordIP . "')"); } + // Get the apache port + $port = $this->GetApachePort(); + if (!filter_var($dnsRecordIP, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { - throw new InvalidSettingConfigurationException("It seems like the ip-address is set to an internal or reserved ip-address. This is not supported. (It was found to be set to '" . $dnsRecordIP . "')"); + $errorMessage = "It seems like the ip-address is set to an internal or reserved ip-address. This is not supported. (It was found to be set to '" . $dnsRecordIP . "')"; + if ($port === '443') { + throw new InvalidSettingConfigurationException($errorMessage); + } else { + error_log($errorMessage); + } } // Check if port 443 is open @@ -224,7 +232,6 @@ class ConfigurationManager $instanceID = $this->GetSecret('INSTANCE_ID'); // set protocol - $port = $this->GetApachePort(); if ($port !== '443') { $protocol = 'https://'; } else {