2025-03-10 15:28:06 +01:00

1.7 KiB

title description
Traefik AddPrefix Documentation Learn how to implement the HTTP AddPrefix middleware in Traefik Proxy to updates request paths before being forwarded. Read the technical documentation.

AddPrefix

The addPrefix middleware updates the path of a request before forwarding it.

Configuration Examples

# Prefixing with /foo
http:
  middlewares:
    add-foo:
      addPrefix:
        prefix: "/foo"
# Prefixing with /foo
[http.middlewares]
  [http.middlewares.add-foo.addPrefix]
    prefix = "/foo"
# Prefixing with /foo
labels:
  - "traefik.http.middlewares.add-foo.addprefix.prefix=/foo"
// Prefixing with /foo
{
  // ...
  "Tags": [
    "traefik.http.middlewares.add-foo.addprefix.prefix=/foo"
  ]
}
# Prefixing with /foo
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: add-foo
spec:
  addPrefix:
    prefix: /foo

Configuration Options

Field Description Default Required
prefix String to add before the current path in the requested URL. It should include a leading slash (/). "" Yes