Skip to content

Commit

Permalink
fix accidental shadowing of $remote in self test
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Jan 5, 2024
1 parent 7682c4d commit 7503e9d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/SelfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ public function test(string $server, OutputInterface $output, bool $ignoreProxyE

// test that the push server is a trusted proxy
try {
$remote = $this->client->get($server . '/test/remote/1.2.3.4', ['nextcloud' => ['allow_local_address' => true], 'verify' => false])->getBody();
$resolvedRemote = $this->client->get($server . '/test/remote/1.2.3.4', ['nextcloud' => ['allow_local_address' => true], 'verify' => false])->getBody();
} catch (\Exception $e) {
$msg = $e->getMessage();
$output->writeln("<error>🗴 can't connect to push server: $msg</error>");
return self::ERROR_OTHER;
}

if ($ignoreProxyError || $remote === '1.2.3.4') {
if ($ignoreProxyError || $resolvedRemote === '1.2.3.4') {
$output->writeln("<info>✓ push server is a trusted proxy</info>");
} else {
$trustedProxies = $this->config->getSystemValue('trusted_proxies', []);
Expand All @@ -154,7 +154,7 @@ public function test(string $server, OutputInterface $output, bool $ignoreProxyE
return self::ERROR_TRUSTED_PROXY;
}

$output->writeln("<error>🗴 push server is not a trusted proxy, please add '$remote' to the list of trusted proxies" .
$output->writeln("<error>🗴 push server is not a trusted proxy, please add '$resolvedRemote' to the list of trusted proxies" .
" or configure any existing reverse proxy to forward the 'x-forwarded-for' send by the push server.</error>");
$output->writeln(" See https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/reverse_proxy_configuration.html#defining-trusted-proxies for how to set trusted proxies.");
$output->writeln(" The following trusted proxies are currently configured: " . implode(', ', array_map(function (string $proxy) {
Expand Down

0 comments on commit 7503e9d

Please sign in to comment.