Traffic Routing

Two of the services on Kong API Gateway have routes configured in the following manner:

Service A:
route:
host: ‘api.example.com
path: ‘/string_01’

Service B:
route:
host: ‘api.example.com
path: ‘/’

Since the hosts are the same, the request coming to api.example.com/string_01 matches “/” before matching “/string_01”, But I want the request coming to api.example.com/string_01 to go to service A.

How can we do it on Kong API Gateway?

If you are running Kong in k8s, one of the options would be to use konghq.com/regex-priority.