ThreeMammals / Ocelot

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

Incorrect routing when the query parameter is in the configuration #2064

Closed Burgyn closed 2 months ago

Burgyn commented 2 months ago

Hi guys.

I discovered strange and different routing behavior between versions 22.0.1 and 23.0.0.

Expected Behavior

In version 22.0.1 the routing works well as expected. We have the following configuration:

{
    "DownstreamPathTemplate": "/{tenantId}/products?{everything}",
    "UpstreamPathTemplate": "/{tenantId}/products?{everything}",
    "UpstreamHttpMethod": [ "Get" ]
},
{
    "DownstreamPathTemplate": "/{tenantId}/products/{everything}",
    "UpstreamPathTemplate": "/{tenantId}/products/{everything}",
    "UpstreamHttpMethod": [ "Get" ]
},

When I call a request

GET localhost/1/products/1

then the correct route "/{tenantId}/products/{everything}" is selected.

Actual Behavior

In version 23.0.0 the "DownstreamPathTemplate":"/{tenantId}/products?{everything}" path is chosen for some reason, which is not correct.

Specifications


Maybe this PR? #748

Any idea for a quick fix on my part? Thank you very much.