Always return overwritehost if configured

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-11-28 14:51:54 +01:00
parent 6b97f6af48
commit a055d8ddf9
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
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;
}