ReplacePath
replacePath 中间件会:
- 将实际路径替换为指定路径。
- 将原始路径存储到
X-Replaced-Path头中。
配置示例¶
# 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"# Replace the path with /foo
labels:
- "traefik.http.middlewares.test-replacepath.replacepath.path=/foo"// Replace the path with /foo
{
// ...
"Tags" : [
"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"配置选项¶
| 字段 | 说明 |
|---|---|
path |
path 选项定义请求 URL 中要替换为的路径。 |