@ -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(current($parts)));
} 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';