Skip to content

Incorrect Routing when a configuration exists with query param wildcard #2132

@garv-daga

Description

@garv-daga

Ocelot now matches routes incorrectly.
This started breaking between versions 22.0.1 and 23.0.0.

If I have two configurations -

{
  "Routes": [
    {
      "DownstreamHostAndPorts": [
        {
          "Host": "{Endpoint1}"
        }
      ],
      "DownstreamPathTemplate": "/api/v1/abc?{everything}",
      "DownstreamScheme": "https",
      "UpstreamPathTemplate": "/api/v1/abc?{everything}"
    },
    {
      "DownstreamHostAndPorts": [
        {
          "Host": "{Endpoint2}"
        }
      ],
      "DownstreamPathTemplate": "/api/v1/{everything}",
      "DownstreamScheme": "https",
      "UpstreamPathTemplate": "/api/v1/abc2/{everything}"
    }
  ]
}

Now if I initiate a call with /api/v1/abc2/apple?isRequired=1

Expected Route: {Endpoint2}/api/v1/apple?isRequired=1

Actually Routes to: {Endpoint1}/api/v1/abc?isRequired=1"

Similar issue reported in: Originally posted by @Burgyn in #2065

Metadata

Metadata

Assignees

No one assigned

    Labels

    NET9.NET 9 releaseRoutingOcelot feature: RoutingbugIdentified as a potential bugmergedIssue has been merged to dev and is waiting for the next release

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions