Traefik - 重定向不适用于没有斜杠的 PathPrefixStrip

Traefik - redirect not work with PathPrefixStrip without slash

我需要重定向特定的 /path,我写了这篇文章:

web1:
    image: httpd
    labels:
      - "traefik.backend=httpd"
      - "traefik.frontend.rule=Host:www.example.com"
      - "traefik.port=80"
web2:
    image: nginx
    labels:
      - "traefik.backend=nginx"
      - "traefik.frontend.rule=Host:www.foobar.com"
      - "traefik.port=80"   
app:
    image: custom/image
    labels:
      - "traefik.backend=app"
      - "traefik.frontend.rule=Host:www.example.com,www.foobar.com; PathPrefixStrip:/app"
      - "traefik.port=80"

当我转到 http://www.example.com/apphttp://www.foobar.com/app 时,我需要进入容器 app,但只有在 [=36] 的末尾插入 / 才能工作=]:

http://www.example.com/app 无效

http://www.foobar.com/app 无效

http://www.example.com/app/工作

http://www.foobar.com/app/ 工作

我已经有一个使用 apache 别名的应用程序版本,我想这不是应用程序的问题

谢谢

我在这里找到了解决方案:https://github.com/containous/traefik/issues/563#issuecomment-421360934

labels:
  - "traefik.frontend.redirect.regex=^(.*)/path$"
  - "traefik.frontend.redirect.replacement=/path/"
  - "traefik.frontend.rule=PathPrefix:/path;ReplacePathRegex: ^/path/(.*) /"