ReplacePath

转发请求之前更新路径

替换请求网址的路径.

Configuration Examples

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

Configuration Options

General

ReplacePath中间件将:

  • 用指定的路径替换实际路径.
  • 将原始路径存储在X-Replaced-Path标头中.

path

path选项定义在请求url中用作替换的路径.