When two routes both match

Kong Course · lesson 3 of 15 · 5 min read

The rule that decides the winner, and the mistake that makes a route unreachable.

Open this lesson in the learning hub

Key points

  • Routes overlap constantly: /v1 and /v1/orders both 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.