Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(SetupChecks): Detect CLI mode in HTTPS / URL generator check #45262

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions apps/settings/lib/SetupChecks/HttpsUrlGeneration.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,19 @@ public function run(): SetupResult {
}
$generatedUrl = $this->urlGenerator->getAbsoluteURL('index.php');
if (!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) {
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.'));
}
}