From 7503e9dddd9a0256a49672281ecde211c3de6823 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 5 Jan 2024 14:07:16 +0100 Subject: [PATCH] fix accidental shadowing of $remote in self test Signed-off-by: Robin Appelman --- lib/SelfTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/SelfTest.php b/lib/SelfTest.php index fd42cff7..9ea2f46c 100644 --- a/lib/SelfTest.php +++ b/lib/SelfTest.php @@ -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("🗴 can't connect to push server: $msg"); return self::ERROR_OTHER; } - if ($ignoreProxyError || $remote === '1.2.3.4') { + if ($ignoreProxyError || $resolvedRemote === '1.2.3.4') { $output->writeln("✓ push server is a trusted proxy"); } else { $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); @@ -154,7 +154,7 @@ public function test(string $server, OutputInterface $output, bool $ignoreProxyE return self::ERROR_TRUSTED_PROXY; } - $output->writeln("🗴 push server is not a trusted proxy, please add '$remote' to the list of trusted proxies" . + $output->writeln("🗴 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."); $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) {