diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-02-19 10:31:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-19 10:31:57 +0100 |
commit | e20292f174469fa4ab17a09cc63c2395ca60ee53 (patch) | |
tree | 90a08d2d572e99e7acbfd1773cc7a30efbee319d /settings | |
parent | 30e7d3e0e8e0c19119e8fcc29c9349f6909e630c (diff) | |
parent | 600bc222975cb8ec41c0191150e5d0ec9ebd51d0 (diff) | |
download | nextcloud-server-e20292f174469fa4ab17a09cc63c2395ca60ee53.tar.gz nextcloud-server-e20292f174469fa4ab17a09cc63c2395ca60ee53.zip |
Merge pull request #14261 from nextcloud/show-warning-if-x-forwarded-set-with-empty-trusted-proxies
Warning if x-forwarded-host present but trusted_proxies empty
Diffstat (limited to 'settings')
-rw-r--r-- | settings/Controller/CheckSetupController.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index d21874e025d..920bf59ea55 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -289,9 +289,14 @@ class CheckSetupController extends Controller { $trustedProxies = $this->config->getSystemValue('trusted_proxies', []); $remoteAddress = $this->request->getHeader('REMOTE_ADDR'); - if (\is_array($trustedProxies) && \in_array($remoteAddress, $trustedProxies)) { + if (empty($trustedProxies) && $this->request->getHeader('X-Forwarded-Host')) { + return false; + } + + if (\is_array($trustedProxies) && \in_array($remoteAddress, $trustedProxies, true)) { return $remoteAddress !== $this->request->getRemoteAddress(); } + // either not enabled or working correctly return true; } |