ReplacePath

Updating the Path Before Forwarding the Request

Replace the path of the request url.

Configuration Examples

  1. # Replace the path by /foo
  2. labels:
  3. - "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
  1. # Replace the path by /foo
  2. apiVersion: traefik.containo.us/v1alpha1
  3. kind: Middleware
  4. metadata:
  5. name: test-replacepath
  6. spec:
  7. replacePath:
  8. path: /foo
  1. "labels": {
  2. "traefik.http.middlewares.test-replacepath.replacepath.path": "/foo"
  3. }
  1. # Replace the path by /foo
  2. labels:
  3. - "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
  1. # Replace the path by /foo
  2. [http.middlewares]
  3. [http.middlewares.test-replacepath.replacePath]
  4. path = "/foo"
  1. # Replace the path by /foo
  2. http:
  3. middlewares:
  4. test-replacepath:
  5. replacePath:
  6. path: "/foo"

Configuration Options

General

The ReplacePath middleware will:

  • replace the actual path by the specified one.
  • store the original path in a X-Replaced-Path header.

path

The path option defines the path to use as replacement in the request url.