Web / Traefik Interview questions
What is the difference between a router's priority and its rule matching?
Rule matching determines whether a router is eligible to handle a given request at all, based on conditions like host or path; priority determines which router wins when more than one eligible rule matches the same request.
By default, Traefik assigns higher priority to more specific rules automatically (a longer, more specific PathPrefix beats a shorter, more generic one), but this can be overridden explicitly with a numeric priority field on the router.
http: routers: specific: rule: "PathPrefix(`/api/v2`)" priority: 100 generic: rule: "PathPrefix(`/api`)" priority: 10
Without an explicit priority, two rules of equal specificity match ties in an order that's hard to predict reliably, which is why production configs with overlapping rules should set priority explicitly rather than relying on the default heuristic.
More Related questions...