When two routes both match
The rule that decides the winner, and the mistake that makes a route unreachable.
Open this lesson in the learning hubKey points
- Routes overlap constantly:
/v1and/v1/ordersboth match/v1/orders/9. - Kong picks the most specific match, not the first one in the file - order in YAML is irrelevant.
- The longest matching path prefix wins; more declared conditions break a tie.
- So a broad catch-all route does not shadow a narrower one - the narrow one still wins.
- The real trap is a route that declares a host you never send, which then silently never matches.
The most specific route wins, so YAML order never matters - but a host you never send makes a route dead.
This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Kong Course course, and every lesson in it is listed on the Kong Course contents page.