ReplacePath
Updating the Path Before Forwarding the Request
Replace the path of the request url.
Configuration Examples
Docker
# Replace the path by /foo
labels:
- "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
Kubernetes
# Replace the path by /foo
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: test-replacepath
spec:
replacePath:
path: /foo
Consul Catalog
# Replace the path by /foo
- "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
Marathon
"labels": {
"traefik.http.middlewares.test-replacepath.replacepath.path": "/foo"
}
Rancher
# Replace the path by /foo
labels:
- "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
File (TOML)
# Replace the path by /foo
[http.middlewares]
[http.middlewares.test-replacepath.replacePath]
path = "/foo"
File (YAML)
# Replace the path by /foo
http:
middlewares:
test-replacepath:
replacePath:
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.