Skip to content

Commit 5b5178a

Browse files
committed
fix(SetupChecks): Detect CLI mode in HTTPS / URL generator check
Signed-off-by: Josh Richards <josh.t.richards@gmail.com>
1 parent 0d52697 commit 5b5178a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

apps/settings/lib/SetupChecks/HttpsUrlGeneration.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,19 @@ public function run(): SetupResult {
6464
}
6565
$generatedUrl = $this->urlGenerator->getAbsoluteURL('index.php');
6666
if (!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-
);
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+
}
7179
}
72-
7380
return SetupResult::success($this->l10n->t('You are accessing your instance over a secure connection, and your instance is generating secure URLs.'));
7481
}
7582
}

0 commit comments

Comments
 (0)