Skip to content

Commit 1736446

Browse files
committed
fix: adjust CLI mode check + messaging changes + add missing docs link
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
1 parent e1b8e9a commit 1736446

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

apps/settings/lib/SetupChecks/HttpsUrlGeneration.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,20 @@ public function run(): SetupResult {
6363
}
6464
}
6565
$generatedUrl = $this->urlGenerator->getAbsoluteURL('index.php');
66-
if (!\OC::$CLI && !str_starts_with($generatedUrl, 'https://')) {
67-
return SetupResult::warning(
68-
$this->l10n->t('You are accessing your instance over a secure connection, however your instance is generating insecure URLs. This most likely means that you are behind a reverse proxy and the overwrite config variables are not set correctly.'),
69-
$this->urlGenerator->linkToDocs('admin-reverse-proxy')
70-
);
71-
}
72-
if (\OC::$CLI) {
73-
/* We were called from CLI so we can't check this */
74-
return SetupResult::info($this->l10n->t('Your URL generation could not be checked from CLI mode.'));
75-
} else {
76-
return SetupResult::success($this->l10n->t('You are accessing your instance over a secure connection, and your instance is generating secure URLs.'));
66+
if (!str_starts_with($generatedUrl, 'https://')) {
67+
if (!\OC::$CLI) {
68+
return SetupResult::warning(
69+
$this->l10n->t('You are accessing your instance over a secure connection, however your instance is generating insecure URLs. This likely means that your instance is behind a reverse proxy and the Nextcloud `overwrite*` config values are not set correctly.'),
70+
$this->urlGenerator->linkToDocs('admin-reverse-proxy')
71+
);
72+
/* We were called from CLI so we can't be 100% sure which scenario is applicable */
73+
} else {
74+
return SetupResult::info(
75+
$this->l10n->t('Your instance is generating insecure URLs. If you access your instance over HTTPS, this likely means that your instance is behind a reverse proxy and the Nextcloud `overwrite*` config values are not set correctly.'),
76+
$this->urlGenerator->linkToDocs('admin-reverse-proxy')
77+
);
78+
}
7779
}
80+
return SetupResult::success($this->l10n->t('You are accessing your instance over a secure connection, and your instance is generating secure URLs.'));
7881
}
7982
}

0 commit comments

Comments
 (0)