Back to Traefik

Traefik ReplacePath Documentation

docs/content/reference/routing-configuration/http/middlewares/replacepath.md

3.7.0-ea.31.1 KB
Original Source

The replacePath middleware will:

  • Replace the actual path with the specified one.
  • Store the original path in a X-Replaced-Path header

Configuration Examples

yaml
# Replace the path with /foo
http:
  middlewares:
    test-replacepath:
      replacePath:
        path: "/foo"
toml
# Replace the path with /foo
[http.middlewares]
  [http.middlewares.test-replacepath.replacePath]
    path = "/foo"
yaml
# Replace the path with /foo
labels:
  - "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
json
// Replace the path with /foo
{
  // ...
  "Tags" : [
    "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
  ]
} 
yaml
# Replace the path with /foo
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: test-replacepath
spec:
  replacePath:
    path: "/foo"

Configuration Options

FieldDescription
<a id="opt-path" href="#opt-path" title="#opt-path">path</a>The path option defines the path to use as replacement in the request URL.