ReplacePath¶
Updating the Path Before Forwarding the Request
Replace the path of the request URL.
Configuration Examples¶
# Replace the path with /foo
labels:
- "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
# Replace the path with /foo
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: test-replacepath
spec:
replacePath:
path: /foo
# Replace the path with /foo
- "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
"labels": {
"traefik.http.middlewares.test-replacepath.replacepath.path": "/foo"
}
# Replace the path with /foo
labels:
- "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"
# Replace the path with /foo
http:
middlewares:
test-replacepath:
replacePath:
path: "/foo"
# Replace the path with /foo
[http.middlewares]
[http.middlewares.test-replacepath.replacePath]
path = "/foo"
Configuration Options¶
General¶
The ReplacePath middleware will:
- replace the actual path with 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.