# Router

Settings for static HTTP routes.

## Configuration

{% tabs %}
{% tab title="JSON" %}

```
{
   "router": {
      "blocked_prefixes": [
         "/api"
      ],
      "routes": {},
      "ui_path": ""
   }
}
```

{% endtab %}

{% tab title="ENV" %}

```
CORE_ROUTER_BLOCKED_PREFIXES="/api"
CORE_ROUTER_ROUTES=
CORE_ROUTER_UI_PATH=
```

{% endtab %}
{% endtabs %}

### blocked\_prefixes (array)

List of path prefixes that are not allowed to be overwritten by a static route. If a static route would overwrite one of the blocked prefixes, an error will be thrown at startup. For the environment variable, provide a comma-separated list of prefixes, e.g. `/prefix1,/prefix2`.

By default this value is set to `["/api"]`.

### routes (map)

A list of static routes. This maps a path to a different path and results in a HTTP redirect, e.g. `{"/foo.txt": "/bar.txt"}` will redirect requests from `/foo.txt` to `/bar.txt`. Path have to start with a `/` and they are based on [storage.disk.dir](/core/configuration/storage.md) on the filesystem.

The special suffix `/*` of a route allows you to serve whole directories from another root than storage.disk.dir, e.g. `{"/ui/*", "/path/to/ui"}`. If you use a relative path as target, then it will be added to the current working directory.

By default no routes are defined.

### ui\_path (string)

A path to a directory holding UI files. This will be mounted as `/ui`.

By default this value is not set, i.e. an empty string.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datarhei.com/core/configuration/router.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
