doudun1934 2018-03-31 23:57
浏览 199
已采纳

在同一主机上使用traefik马拉松进行多路径路由

I have two apps running on marathon.
I want web.myblog.com to route to App 1, and web.myblog.com/app to route to app2.

With the below config, all traffic is going to app 1.

App 1  
traefik.frontend.rule=HostRegexp:{subdomain:[a-z]+}.myblog.com

App 2  
traefik.frontend.rule=Host:web.myblog.com;PathPrefix:/app

I tried using negative matching to exclude /app routing for app 1, but it is my understanding that negative lookahead isn't fully supported in golang and by result also not in traefik.

I also tried specifying a path prefix for app 1 like so traefik.frontend.rule=Host:web.myblog.com;PathPrefix:/ but this has no effect.

When I modify the rule for App 1 to point to Host:test.myblog.com all traffic goes to app 2 correctly, From that I conclude that the routing config to App 2 is correct, it is just being ignored because App 1 supersedes it since it also satisfies the route.

This issue is discussing this exact use case:
https://github.com/containous/traefik/issues/419#issuecomment-223843103

But it looks like a config without pathPrefix takes precedence over a config with pathPrefix, maybe this type of config is simply not supported on the marathon backend ?

It's not clear to me from this documentation:
https://github.com/fclaeys/traefik/blob/master/docs/basics.md.

Looking for an answer that will help me understand whether this use case is supported at all on the marathon backend, or an example working config for it.

Using Traefik v1.5.1

  • 写回答

2条回答 默认 最新

  • doudi2431 2018-04-01 01:52
    关注

    If multiple rules match traefic will use the length of the rule to determine which rule is most specific instead of the actual specificity. You can override this artificial priority by using

    traefik.frontend.priority=1000

    More info: https://github.com/containous/traefik/issues/1663

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?