Overlapping API paths

Hi lets say i have two APIs

1)v1/test/{test_path}
2)v1/test/test-url

url_rewrite for v1/test/{test_path}
“url_rewrites”: [
{
“path”: “/”,
“method”: “GET”,
“match_pattern”: “v1/test/(??.)",
“rewrite_to”: “v1/test/$1$2”,
“triggers”:
},
{
“path”: “/”,
“method”: “POST”,
“match_pattern”: "v1/test/(?!(?:[a-zA-Z_-]+(?:?.
)?$))([a-zA-Z0-9:-]+)(?.)?",
“rewrite_to”: “v1/test/$1$2”,
“triggers”: []
},
{
“path”: “/”,
“method”: “PATCH”,
“match_pattern”: "v1/test/(?!(?:[a-zA-Z
-]+(?:?.
)?$))([a-zA-Z0-9:-]+)(?.*)?”,
“rewrite_to”: “v1/test/$1$2”,
“triggers”:
},
{
“path”: “/”,
“method”: “DELETE”,
“match_pattern”: “v1/test/(?!(?:[a-zA-Z
-]+(?:?.)?$))([a-zA-Z0-9:_-]+)(?.)?”,
“rewrite_to”: “v1/test/$1$2”,
“triggers”:
},
{
“path”: “/”,
“method”: “PUT”,
“match_pattern”: “v1/test/(?![a-zA-Z-]+$)([a-zA-Z0-9:-]+)(??.*)”,
“rewrite_to”: “v1/test/$1$2$3”,
“triggers”: [
]
}
],

now if i call v1/test/test-url call is going to v1/test/{path_param} because regex is matching

  1. either we need to restrict based on method or set some high priority for v1/test/test-url api we cant change the regex because its our path param this is just a sample url we have give we have 100 such apis with issue

You may have to try to avoid overlapping paths. Or maybe use a single regex path and utilize our path_part_matches advanced URL rewrite to check the components of the path

For example:
URL: /test/foo/rewrite
Rewrite URL: /change/to/me/foo

"extended_paths": {
  "url_rewrites": [
  {
    "path": "/test",
    "method": "POST",
    "match_pattern": "/test",
    "rewrite_to": "{{fallback_url}}",
    "triggers": [
	  {
	    "on": "any",
	    "options": {
		"path_part_matches": {
		    "pathpart": {
			  "match_rx": "foo",
			  "reverse": false
		    }
		  },
		  "query_val_matches": {},
		  "header_matches": {},
		  "session_meta_matches": {},
		  "request_context_matches": {},
		  "payload_matches": {
		    "match_rx": ""
		  }
	    },
	    "rewrite_to": "/change/me/to/$tyk_context.trigger-0-pathpart-0"
	  }
      ]
  }]
}

Note: Context variables are required

I don’t think we have a priority setter. You may have to structure your regex properly to test for anything but test-url rather than using a placeholder wildcard {test_path}