getgrav/grav · error · RuntimeException

Bad configuration: system.custom_base_url

Error message

Bad configuration: system.custom_base_url

What it means

Error "Bad configuration: system.custom_base_url" thrown in getgrav/grav.

Source

Thrown at system/src/Grav/Common/Uri.php:174

        $grav = Grav::instance();

        /** @var Config $config */
        $config = $grav['config'];

        /** @var Language $language */
        $language = $grav['language'];

        // add the port to the base for non-standard ports
        if ($this->port && $config->get('system.reverse_proxy_setup') === false) {
            $this->base .= ':' . $this->port;
        }

        // Handle custom base
        $custom_base = rtrim((string) $grav['config']->get('system.custom_base_url', ''), '/');
        if ($custom_base) {
            $custom_parts = parse_url($custom_base);
            if ($custom_parts === false) {
                throw new RuntimeException('Bad configuration: system.custom_base_url');
            }
            $orig_root_path = $this->root_path;
            $this->root_path = isset($custom_parts['path']) ? rtrim($custom_parts['path'], '/') : '';
            if (isset($custom_parts['scheme'])) {
                $this->base = $custom_parts['scheme'] . '://' . $custom_parts['host'];
                $this->port = $custom_parts['port'] ?? null;
                if ($this->port && $config->get('system.reverse_proxy_setup') === false) {
                    $this->base .= ':' . $this->port;
                }
                $this->root = $custom_base;
            } else {
                $this->root = $this->base . $this->root_path;
            }
            $this->uri = Utils::replaceFirstOccurrence($orig_root_path, $this->root_path, $this->uri);
        } else {
            $this->root = $this->base . $this->root_path;
        }
        $this->root_url = null;

View on GitHub (pinned to 6040efed04)

When it happens

Trigger: Thrown at system/src/Grav/Common/Uri.php:174 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of getgrav/grav@6040efed04 (2026-08-17). Data as JSON: /api/errors/9bd1550e43cf308c. Report an issue: GitHub.