summaryrefslogtreecommitdiffstats
path: root/lib/private/appframework/http
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-02-25 02:51:46 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2015-02-25 02:51:46 -0800
commitbcf3704645c074be0fa2579eebdc363a2e379765 (patch)
treedb1b7031ca884e3538b1cabc4d397de8def8b51c /lib/private/appframework/http
parentaf96078153f385fd8a9f7f7e2b295aa01f8b0973 (diff)
parent9adcd15cb35ef4f02db073116dcce78c735cd292 (diff)
downloadnextcloud-server-bcf3704645c074be0fa2579eebdc363a2e379765.tar.gz
nextcloud-server-bcf3704645c074be0fa2579eebdc363a2e379765.zip
Merge pull request #14458 from owncloud/revive/11157
Get the real protocol behind several proxies
Diffstat (limited to 'lib/private/appframework/http')
-rw-r--r--lib/private/appframework/http/request.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/private/appframework/http/request.php b/lib/private/appframework/http/request.php
index def284cdeab..95b99efafe8 100644
--- a/lib/private/appframework/http/request.php
+++ b/lib/private/appframework/http/request.php
@@ -480,8 +480,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
/**
- * Returns the server protocol. It respects reverse proxy servers and load
- * balancers.
+ * Returns the server protocol. It respects one or more reverse proxies servers
+ * and load balancers
* @return string Server protocol (http or https)
*/
public function getServerProtocol() {
@@ -491,7 +491,13 @@ class Request implements \ArrayAccess, \Countable, IRequest {
}
if (isset($this->server['HTTP_X_FORWARDED_PROTO'])) {
- $proto = strtolower($this->server['HTTP_X_FORWARDED_PROTO']);
+ if (strpos($this->server['HTTP_X_FORWARDED_PROTO'], ',') !== false) {
+ $parts = explode(',', $this->server['HTTP_X_FORWARDED_PROTO']);
+ $proto = strtolower(trim($parts[0]));
+ } else {
+ $proto = strtolower($this->server['HTTP_X_FORWARDED_PROTO']);
+ }
+
// Verify that the protocol is always HTTP or HTTPS
// default to http if an invalid value is provided
return $proto === 'https' ? 'https' : 'http';