【发布时间】:2021-05-20 12:46:45
【问题描述】:
我在my.host.com/foo/bar/docpath 有一个文档,我希望它可以在网址my.host.com/docpath 上找到。我所有的 Traefik 配置都在一个 docker-compose 文件中。
这是我的服务容器中的配置:
labels:
traefik.enable: "true"
traefik.http.routers.myservice.entrypoints: secure
traefik.http.routers.myservice.middlewares: rewritepath
traefik.http.routers.myservice.rule: "Host(`my.host.com`) && Path(`/docpath`)"
在 Traefik 的容器标签中:
labels:
traefik.http.middlewares.rewritepath.addprefix.prefix: /foo/bar
问题:当我请求 my.host.com/docpath 时,出现 404 错误。我做错了什么?
(假设我使用简单的规则正确访问my.host.com/foo/bar/docpath:“Host(`my.host.com`)”并且没有中间件)
【问题讨论】:
标签: traefik