Fast Redirect

Use Fast Redirect to easily redirect your domains.

Fast Redirects expects a JSON ‘database’. This JSON ‘database’ contains the domains to be redirected. Fast Redirect then redirects traffic as configured.

Fast Redirect uses Starlette, a high-performance ASGI framework. Your redirects are lightning fast. Requirements for all environments can be found in the requirements directory.

How to use


We recommend running Fast Redirect in a venv. The package has been published to PyPI, so you could install it with pip3 install fast-redirect.


All configuration variables can be found in the .env.example file. Only one configuration variable is required to be set: DATABASE_PATH. We recommend setting it to /var/lib/fast-redirect.json. Configuration variables can be set in an .env file or be passed as environment variables.

Run bin/fast-redirect to start the server. By default, it listens on port 8080 and binds to ::1 (IPv6). The server can be daemonized. An example systemd configuration can be found in fast-redirect.service.

JSON Database

The JSON database contains a redirects object. In turn, this object contains an object for each redirect with the following properties:

  • destination_url. The URL to redirect to. Query parameters and the path may be appended (see other options). This must be a URL (i.e. is invalid).
  • status_code. Allowed values 301, 302 and 303.
  • keep_query_parameters. Whether query parameters are kept. If this is false, query parameters are discarded from the destination_url. For example, if this is false, would be redirected to
  • keep_path. Whether the path is kept. If this is false, the path is discarded from the destination_url. For example, if this is false, would be redirected to

In case a redirect is misconfigured, the error is returned to the visitor.

Example JSON database:

  "redirects": {
    "": {
      "destination_url": "",
      "status_code": 301,
      "keep_query_parameters": true,
      "keep_path": true


Feel free to contribute by adding support for real database engines.


pytest is used for tests. You run it as you’d expect, i.e.:

pytest tests/


You can reach us at [email protected] to report security issues.


View Github