I am using Traefik in Kubernetes. One of my IngressRoute uses:
match: Host(`myhost.cno.lan`)
We need to allow access to any link starting with `myhost.cno.lan` but to deny access to any link starting with `myhost.cno.lan/real` and also to deny access to any link that starts with `myhost.cno.lan/data`
Can this be done with Traefik?
Thanks in advance
Sure, just create a new Traefik router
with rule
:
Host(`myhost.cno.lan`) && ( PathPrefix(`/real`) || PathPrefix(`/data`) )
and a dedicate target service or noop
You mean:
…
routes:
- match: Host(`myhost.cno.lan`)
kind: Rule
... <some other code>
- match: Host(`myhost.cno.lan`) && ( PathPrefix(`/real`) || PathPrefix(`/data`) )
kind: Rule
... <Run some noop service = kind of null service>
Wouldn't this always run the first rule?
Thank you very much
Every Traefik rule has a priority, that is set by default to the length of the rule. The highest (number) priority rule is tested first, if it does not match, the next is tested and so on (doc).