Router

Settings for static HTTP routes.

Configuration

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

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 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.

Last updated