Merge pull request #18151 from nextcloud/bugfix/noid/overwrite-host-proxy

Always return overwritehost if configured
This commit is contained in:
Roeland Jago Douma 2019-12-03 07:48:19 +01:00 committed by GitHub
commit 1e91b6a716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -853,6 +853,10 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @return string Server host
*/
public function getInsecureServerHost(): string {
if ($this->fromTrustedProxy() && $this->getOverwriteHost() !== null) {
return $this->getOverwriteHost();
}
$host = 'localhost';
if ($this->fromTrustedProxy() && isset($this->server['HTTP_X_FORWARDED_HOST'])) {
if (strpos($this->server['HTTP_X_FORWARDED_HOST'], ',') !== false) {
@ -868,6 +872,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
$host = $this->server['SERVER_NAME'];
}
}
return $host;
}