when creating different routes that have a common prefix but are differentiated with a parameter, route matching becomes dependent on the registration order.
Consider the case:
uri for route_a: /api/:version/test/api/projects/:project_id/clusters/:cluster_id/nodes/?
uri for route_b: /api/:version/test/*subpath
path to be matched: /api/v4/test/api/projects/saas/clusters/123/nodes/
Theoretically, the above path should match route_a but due to the bug if route_b is registered before route_a, route_b will be matched
Fixes https://github.com/apache/apisix/issues/9366
Explanation:
when creating different routes that have a common prefix but are differentiated with a parameter, route matching becomes dependent on the registration order.
Consider the case:
uri for route_a:
/api/:version/test/api/projects/:project_id/clusters/:cluster_id/nodes/?
uri for route_b:/api/:version/test/*subpath
path to be matched:
/api/v4/test/api/projects/saas/clusters/123/nodes/
Theoretically, the above path should match
route_a
but due to the bug ifroute_b
is registered beforeroute_a
,route_b
will be matched