mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
Better fix for system.custom_base_url, which does not affect other urls
This commit is contained in:
parent
e5727462e7
commit
a24ec2c433
|
|
@ -158,6 +158,11 @@ class Uri
|
|||
/** @var Language $language */
|
||||
$language = $grav['language'];
|
||||
|
||||
// add the port to the base for non-standard ports
|
||||
if ($this->port !== null && $config->get('system.reverse_proxy_setup') === false) {
|
||||
$this->base .= ':' . (string)$this->port;
|
||||
}
|
||||
|
||||
// Handle custom base
|
||||
$custom_base = rtrim($grav['config']->get('system.custom_base_url'), '/');
|
||||
if ($custom_base) {
|
||||
|
|
@ -170,6 +175,9 @@ class Uri
|
|||
if (isset($custom_parts['scheme'])) {
|
||||
$this->base = $custom_parts['scheme'] . '://' . $custom_parts['host'];
|
||||
$this->port = $custom_parts['port'] ?? null;
|
||||
if ($this->port !== null && $config->get('system.reverse_proxy_setup') === false) {
|
||||
$this->base .= ':' . (string)$this->port;
|
||||
}
|
||||
$this->root = $custom_base;
|
||||
} else {
|
||||
$this->root = $this->base . $this->root_path;
|
||||
|
|
@ -179,11 +187,6 @@ class Uri
|
|||
$this->root = $this->base . $this->root_path;
|
||||
}
|
||||
|
||||
// add the port to the base for non-standard ports
|
||||
if ($this->port !== null && $config->get('system.reverse_proxy_setup') === false) {
|
||||
$this->base .= ':' . (string)$this->port;
|
||||
}
|
||||
|
||||
$this->url = $this->base . $this->uri;
|
||||
|
||||
$uri = Utils::replaceFirstOccurrence(static::filterPath($this->root), '', $this->url);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user