Skip to content

Bug with catch-all routing #2169

@istanko

Description

@istanko

Hello,

I have a problem with two get routes. One of them is not getting hit.

Expected Behavior / New Feature

With the following configuration, expected behavior should be that calling /api/products?query=test is redirected to the downstream path template /api/products?query=test, and that calling /api/products/1 is redirected to the downstream path template /api/products/1

{
  "UpstreamPathTemplate": "/api/products?{everything}",
  "UpstreamHttpMethod": [
    "Get",
    "Options"
  ],
  "DownstreamPathTemplate": "/api/products-something?{everything}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
      "Host": "localhost",
      "Port": 80
    }
  ]
},
{
  "UpstreamPathTemplate": "/api/products/{id}",
  "UpstreamHttpMethod": [
    "Get",
    "Options"
  ],
  "DownstreamPathTemplate": "/api/products/{id}",
  "DownstreamScheme": "http",
  "DownstreamHostAndPorts": [
    {
      "Host": "localhost",
      "Port": 80
    }
  ]
}

Actual Behavior / Motivation for New Feature

Calling /api/products/1 will be routed to downstream path template /api/products?1

Steps to Reproduce the Problem

Use the provided configuration and make calls to both endpoints.

Specifications

  • Version: 23.3.4
  • Platform: .NET 8
  • Subsystem: Windows

Metadata

Metadata

Assignees

Labels

ConfigurationOcelot feature: ConfigurationNET9.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