public function getBaseUrl(): string
{ $trustedPrefix = '';
// the proxy prefix must be prepended to any prefix being needed at the webserver level
if ($this->
isFromTrustedProxy() &&
$trustedPrefixValues =
$this->
getTrustedValues(self::HEADER_X_FORWARDED_PREFIX
)) { $trustedPrefix =
rtrim($trustedPrefixValues[0
], '/'
);
} return $trustedPrefix.
$this->
getBaseUrlReal();
} /**
* Returns the real base URL received by the webserver from which this request is executed.
* The URL does not include trusted reverse proxy prefix.
*
* @return string The raw URL (i.e. not urldecoded)
*/
private function getBaseUrlReal(): string
{ return $this->baseUrl ??=
$this->
prepareBaseUrl();
}