Add Prefix

Prefixing the Path

AddPrefix

The AddPrefix middleware updates the URL Path of the request before forwarding it.

Configuration Examples

  1. # Prefixing with /foo
  2. labels:
  3. - "traefik.http.middlewares.add-foo.addprefix.prefix=/foo"
  1. # Prefixing with /foo
  2. apiVersion: traefik.containo.us/v1alpha1
  3. kind: Middleware
  4. metadata:
  5. name: add-foo
  6. spec:
  7. addPrefix:
  8. prefix: /foo
  1. "labels": {
  2. "traefik.http.middlewares.add-foo.addprefix.prefix": "/foo"
  3. }
  1. # Prefixing with /foo
  2. labels:
  3. - "traefik.http.middlewares.add-foo.addprefix.prefix=/foo"
  1. # Prefixing with /foo
  2. [http.middlewares]
  3. [http.middlewares.add-foo.addPrefix]
  4. prefix = "/foo"
  1. # Prefixing with /foo
  2. http:
  3. middlewares:
  4. add-foo:
  5. addPrefix:
  6. prefix: "/foo"

Configuration Options

prefix

prefix is the string to add before the current path in the requested URL. It should include the leading slash (/).