我在my.host.com/foo/bar/docpath上有一个文档,我想让它在url 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)”而没有中间件来正确地访问my.host.com/foo/bar/docpath )
发布于 2021-02-17 23:45:06
我对traefik的理解是,中间件是根据规则命名的。
尝尝这个。
- "traefik.http.routers.myservice.rule: "Host(`my.host.com`) && Path(`/docpath`)"
- "traefik.http.routers.myservice.middlewares=rewritepath"
- "traefik.http.middlewares.rewritepath.addprefix.prefix=/foo/bar"https://stackoverflow.com/questions/66245176
复制相似问题