summaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorMario Danic <mario@lovelyhq.com>2018-01-12 08:57:51 +0100
committerMorris Jobke <hey@morrisjobke.de>2018-01-15 00:49:22 +0100
commitc7eaa26f736e922090e69a00222cb2e6453036ed (patch)
tree9f24a54da55e020ef9380e77e8f2a32bffb00bb1 /core/Controller
parent4f30c2fbe43e0d6f24ba3bff881526b2b6c2747d (diff)
downloadnextcloud-server-c7eaa26f736e922090e69a00222cb2e6453036ed.tar.gz
nextcloud-server-c7eaa26f736e922090e69a00222cb2e6453036ed.zip
Fix bug with proxies
Signed-off-by: Mario Danic <mario@lovelyhq.com>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/ClientFlowLoginController.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php
index 7d6e79d39bc..0e7fbf892b6 100644
--- a/core/Controller/ClientFlowLoginController.php
+++ b/core/Controller/ClientFlowLoginController.php
@@ -315,7 +315,18 @@ class ClientFlowLoginController extends Controller {
$serverPostfix = substr($this->request->getRequestUri(), 0, strpos($this->request->getRequestUri(), '/login/flow'));
}
- $serverPath = $this->request->getServerProtocol() . "://" . $this->request->getServerHost() . $serverPostfix;
+ $protocol = $this->request->getServerProtocol();
+
+ if ($protocol !== "https") {
+ $xForwardedProto = $this->request->getHeader('X-Forwarded-Proto');
+ $xForwardedSSL = $this->request->getHeader('X-Forwarded-Ssl');
+ if ($xForwardedProto === 'https' || $xForwardedSSL === 'on') {
+ $protocol = 'https';
+ }
+ }
+
+
+ $serverPath = $protocol . "://" . $this->request->getServerHost() . $serverPostfix;
$redirectUri = 'nc://login/server:' . $serverPath . '&user:' . urlencode($loginName) . '&password:' . urlencode($token);
}