Skip to content

Commit

Permalink
fix: adjust CLI mode check + messaging changes + add missing docs link
Browse files Browse the repository at this point in the history
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
  • Loading branch information
joshtrichards committed May 12, 2024
1 parent e1b8e9a commit 1736446
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions apps/settings/lib/SetupChecks/HttpsUrlGeneration.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,20 @@ public function run(): SetupResult {
}
}
$generatedUrl = $this->urlGenerator->getAbsoluteURL('index.php');
if (!\OC::$CLI && !str_starts_with($generatedUrl, 'https://')) {
return SetupResult::warning(
$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.'),
$this->urlGenerator->linkToDocs('admin-reverse-proxy')
);
}
if (\OC::$CLI) {
/* We were called from CLI so we can't check this */
return SetupResult::info($this->l10n->t('Your URL generation could not be checked from CLI mode.'));
} else {
return SetupResult::success($this->l10n->t('You are accessing your instance over a secure connection, and your instance is generating secure URLs.'));
if (!str_starts_with($generatedUrl, 'https://')) {
if (!\OC::$CLI) {
return SetupResult::warning(
$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.'),
$this->urlGenerator->linkToDocs('admin-reverse-proxy')
);
/* We were called from CLI so we can't be 100% sure which scenario is applicable */
} else {
return SetupResult::info(
$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.'),
$this->urlGenerator->linkToDocs('admin-reverse-proxy')
);
}
}
return SetupResult::success($this->l10n->t('You are accessing your instance over a secure connection, and your instance is generating secure URLs.'));
}
}

0 comments on commit 1736446

Please sign in to comment.