ThreeMammals / Ocelot

.NET API Gateway
https://www.nuget.org/packages/Ocelot
MIT License
8.24k stars 1.62k forks source link

Routing issue when use {Literals} at last #2092

Closed adelvadia closed 1 month ago

adelvadia commented 1 month ago

I have multiple route configurations in ocelot.json

{
     "UpstreamPathTemplate": "/{Version}/List/{ListId}",
     "DownstreamPathTemplate": "/Api/{Version}/List/{ListId}",
     ...
     ...
},
{
     "UpstreamPathTemplate": "/{Version}/List/{ListId}/View/{ViewId}/Records",
     "DownstreamPathTemplate": "/Api/{Version}/List/{ListId}/View/{ViewId}/Records",
     ...
     ...
}

GET http://localhost/V1/List/100/View/256/Records

Above GET request matches first route instead of second one.

I can resolve this issue by specifying high priority to second one. Here, I expect best match instead of first match. Is there any solution to do so?

Specifications