prepareBaseUrl example

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();
    }

    /** * Gets the request's scheme. */
    public function getScheme(): string
    {
        return $this->isSecure() ? 'https' : 'http';
    }

    /** * Returns the port on which the request is made. * * This method can read the client port from the "X-Forwarded-Port" header * when trusted proxies were set via "setTrustedProxies()". * * The "X-Forwarded-Port" header must contain the client port. * * @return int|string|null Can be a string if fetched from the server bag */
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();
    }

    /** * Gets the request's scheme. */
    public function getScheme(): string
    {
        return $this->isSecure() ? 'https' : 'http';
    }

    /** * Returns the port on which the request is made. * * This method can read the client port from the "X-Forwarded-Port" header * when trusted proxies were set via "setTrustedProxies()". * * The "X-Forwarded-Port" header must contain the client port. * * @return int|string|null Can be a string if fetched from the server bag */

        if (($baseUrl !== null) && !\is_string($baseUrl)) {
            return $this;
        }

        if ($baseUrl !== null) {
            $this->baseUrl = rtrim($baseUrl, '/');

            return $this;
        }

        $this->baseUrl = $this->prepareBaseUrl();

        return $this;
    }

    /** * {@inheritdoc} */
    public function getBaseUrl($raw = false)
    {
        if ($this->baseUrl === null) {
            $this->baseUrl = $this->prepareBaseUrl();
        }
Home | Imprint | This part of the site doesn't use cookies.