HTTP Path Rewrites

If you want to host Redpanda Console under a sub-path rather than the root path, you need to configure HTTP path rewrites. HTTP path rewrites allow you to serve Redpanda Console under a sub-path of your domain, rather than from the root. For example, you may want to have Redpanda Console accessible from https://my-company.com/redpanda/console, instead of directly from https://my-company.com. This type of configuration is often necessary when:

  • You have multiple services and applications running under the same domain.

  • Redpanda Console is behind a reverse proxy. The proxy might add a path prefix based on routing rules. In this scenario, Redpanda Console needs to know about this prefix to handle requests.

If you host Redpanda Console at a root path, for example under a sub-domain such as https://console.redpanda.my-company.com, you don’t need to configure HTTP path rewrites.

Configuration

To configure HTTP path rewrites, you must edit the following properties:

  • basePath: Set the sub-path under which Redpanda Console is hosted.

  • setBasePathFromXForwardedPrefix: Tell Redpanda Console to check the X-Forwarded-Prefix header for a prefix.

  • stripPrefix: Remove the prefix from the request path before internal routing.

These properties are defined in the server object:

server:
  # basePath is the sub-path under which Console will be hosted.
  # If you have a reverse proxy in front of Console, that sets
  # the `X-Forwarded-Prefix` header and the configuration property
  # setBasePathFromXForwardedPrefix is true, you don't need to set
  # this.
  basePath: ""

  # If true, Console will check the `X-Forwarded-Prefix` header
  # on all incoming requests. If the header is present, its value
  # will be used as path prefix.
  setBasePathFromXForwardedPrefix: true

  # Some reverse proxies, such as Traefik,
  # can remove a prefix from the URL path before forwarding it to
  # downstream services like Console. If a prefix is set, it must be
  # removed at some point before reaching Console's internal routing.
  # We recommend that only one part of the stack removes the
  # prefix. If you are using a reverse proxy that modifies the
  # request path, you should either disable stripPrefix or
  # configure the proxy so it doesn't modify the path of a request.
  stripPrefix: true

Proxy rewrites

If you have a reverse proxy between Redpanda Console and Kafka Connect, ensure that any rewrite rules include expand parameters in the query string. These parameters are necessary for Kafka Connect to return the correct details about the connector:

://<kafka_connect_host>:8083/connectors?expand=info&expand=status