diff options
author | Mario Danic <mario@lovelyhq.com> | 2018-01-12 08:57:51 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2018-01-15 00:50:49 +0100 |
commit | cc742ce9e7a2df00f4309e4b3b9fc8d5642ff59f (patch) | |
tree | 83b5d0443cac74843a6a8eb3e51cdda8a4b506ae /core | |
parent | c14dad90e840b52648f6f8511c57dcb2a0e1be77 (diff) | |
download | nextcloud-server-cc742ce9e7a2df00f4309e4b3b9fc8d5642ff59f.tar.gz nextcloud-server-cc742ce9e7a2df00f4309e4b3b9fc8d5642ff59f.zip |
Fix bug with proxies
Signed-off-by: Mario Danic <mario@lovelyhq.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/Controller/ClientFlowLoginController.php | 13 |
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); } |