summaryrefslogtreecommitdiffstats
path: root/settings/Controller
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2018-10-25 22:30:42 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2018-10-25 23:01:37 +0200
commit5cf8f4a407787151a8aa47c35e9aa2aa5a3d443c (patch)
tree07636c51314674627fc244fea5f91848a99b571f /settings/Controller
parent986f4df2a59547ae08359fe7907147577222a8a7 (diff)
downloadnextcloud-server-5cf8f4a407787151a8aa47c35e9aa2aa5a3d443c.tar.gz
nextcloud-server-5cf8f4a407787151a8aa47c35e9aa2aa5a3d443c.zip
Update logic for forwardedForHeadersWorking
As discussed in https://github.com/nextcloud/server/issues/11594 when discovering if x-forwarded-for is working properly its not possible to use getRemoteAddr because the "client ip" is returned. For this check the ip of the last hop would be required. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'settings/Controller')
-rw-r--r--settings/Controller/CheckSetupController.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php
index 42bb4739870..fa4ed57ab95 100644
--- a/settings/Controller/CheckSetupController.php
+++ b/settings/Controller/CheckSetupController.php
@@ -287,12 +287,11 @@ class CheckSetupController extends Controller {
*/
private function forwardedForHeadersWorking() {
$trustedProxies = $this->config->getSystemValue('trusted_proxies', []);
- $remoteAddress = $this->request->getRemoteAddress();
+ $remoteAddress = $this->request->getHeader('REMOTE_ADDR');
- if (is_array($trustedProxies) && in_array($remoteAddress, $trustedProxies)) {
- return false;
+ if (\is_array($trustedProxies) && \in_array($remoteAddress, $trustedProxies)) {
+ return $remoteAddress !== $this->request->getRemoteAddress();
}
-
// either not enabled or working correctly
return true;
}