mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
make the domain check more verbose and allow to debug it better
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
be7d57cf9f
commit
3bf0a769c7
2 changed files with 12 additions and 8 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
}
|
}
|
||||||
lastError = toast
|
lastError = toast
|
||||||
body.prepend(toast)
|
body.prepend(toast)
|
||||||
setTimeout(toast.remove.bind(toast), 7000)
|
setTimeout(toast.remove.bind(toast), 10000)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleEvent(e) {
|
function handleEvent(e) {
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ class ConfigurationManager
|
||||||
public function SetDomain(string $domain) : void {
|
public function SetDomain(string $domain) : void {
|
||||||
// Validate domain
|
// Validate domain
|
||||||
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
|
if (!filter_var($domain, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
|
||||||
throw new InvalidSettingConfigurationException("Domain is not in a valid format!");
|
throw new InvalidSettingConfigurationException("Domain is not a valid domain!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate that it is not an IP-address
|
// Validate that it is not an IP-address
|
||||||
|
|
@ -202,14 +202,15 @@ class ConfigurationManager
|
||||||
|
|
||||||
// Validate IP
|
// Validate IP
|
||||||
if(!filter_var($dnsRecordIP, FILTER_VALIDATE_IP)) {
|
if(!filter_var($dnsRecordIP, FILTER_VALIDATE_IP)) {
|
||||||
throw new InvalidSettingConfigurationException("DNS config is not set or domain is not in a valid format!");
|
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 . "')");
|
||||||
}
|
}
|
||||||
|
|
||||||
$connection = @fsockopen($domain, 443, $errno, $errstr, 0.1);
|
// Check if port 443 is open
|
||||||
|
$connection = @fsockopen($domain, 443, $errno, $errstr, 10);
|
||||||
if ($connection) {
|
if ($connection) {
|
||||||
fclose($connection);
|
fclose($connection);
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidSettingConfigurationException("The server is not reachable on Port 443.");
|
throw new InvalidSettingConfigurationException("The server is not reachable on Port 443. You can verify this e.g. with 'https://portchecker.co/' by entering your domain there as ip-address and port 443 as port.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Instance ID
|
// Get Instance ID
|
||||||
|
|
@ -223,15 +224,18 @@ class ConfigurationManager
|
||||||
$protocol = 'http://';
|
$protocol = 'http://';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if response is correct
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $protocol . $domain . ':443');
|
$testUrl = $protocol . $domain . ':443';
|
||||||
|
curl_setopt($ch, CURLOPT_URL, $testUrl);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
$response = (string)curl_exec($ch);
|
$response = (string)curl_exec($ch);
|
||||||
# Get rid of trailing \n
|
# Get rid of trailing \n
|
||||||
$response = str_replace("\n", "", $response);
|
$response = str_replace("\n", "", $response);
|
||||||
|
|
||||||
if ($response !== $instanceID) {
|
if ($response !== $instanceID) {
|
||||||
throw new InvalidSettingConfigurationException("Domain does not point to this server or reverse proxy not configured correctly.");
|
error_log('The response of the connection attempt to "' . $testUrl . '" was: ' . $response);
|
||||||
|
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')");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write domain
|
// Write domain
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue