Sorry this might be a stupid question, but I can't seem to find it anywhere. So here it goes....
Is there a way to use pathprefix selectively?
Ie
Sub1.tld/prefix >>> sub1 app
Sub2.tld/prefix >>> sub1 app
Sub3.tld/prefix >>> sub3 app
So if I use ="host(sub1.tld) || pathprefix(prefix)"
How do I stop it from effecting only
="Host(sub3.tld)"
Thanks for the advise
cakiwi
June 4, 2021, 12:24am
2
Rule priority is calculated by rule length. But you can also modify a rule priority.
https://doc.traefik.io/traefik/routing/routers/#priority
In your example:
traefik.http.routers.sub1.rule: Host(`sub1.tld`) || PathPrefix(`/prefix`)
traefik.http.routers.sub3.rule: Host(`sub3.tld`)
The first rule is longer and will always be evaluated before the second. So http://sub3.tld/prefix
would match the first rule. Using the priority label you can set sub3 to priority 50 then it would be evaluated first.
traefik.http.routers.sub1.rule: Host(`sub1.tld`) || PathPrefix(`/prefix`)
traefik.http.routers.sub3.rule: Host(`sub3.tld`)
traefik.http.routers.sub3.priority: 50