ThreeMammals / Ocelot

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

routes became case-sensitive after updating from 23.3.6 to 23.4.0 #2209

Closed cmgchess closed 6 days ago

cmgchess commented 1 week ago

Expected Behavior / New Feature

I expected the route to hit

Actual Behavior / Motivation for New Feature

Route didn't hit. Got 400 error .

Steps to Reproduce the Problem

  1. Updated Ocelot and Ocelot.Cache.CacheManager from 23.3.6 to 23.4.0
  2. I called this from my frontend. Notice the uppercase letters of the request issued.
    getEntityRecords(id: number): Observable<EventLogData[]> {
    const url = 'https://blablabla.azurecontainerapps.io/Entities/${id}/Events/RecordsData';
    return this.httpClient.get<EventLogData[]>(url);
    }

    ocelot.json looks like this

    {
    "Routes": [
    {
      "DownstreamPathTemplate": "/api/entities/{id}/events/recordsdata",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "blabla-service.net",
          "Port": 443
        }
      ],
      "UpstreamPathTemplate": "/entities/{id}/events/recordsdata",
      "UpstreamHttpMethod": [
        "GET"
      ],
      "FileCacheOptions": {
        "TtlSeconds": 0,
        "Region": "UserCache"
      },
      "RouteClaimsRequirement": {
        "Claims": "ReadEntities"
      }
    }
    ],
    "GlobalConfiguration": {
    "BaseUrl": "https://blablabla.azurecontainerapps.io"
    }
    }
  3. What's interesting is when I send the request const url = 'https://blablabla.azurecontainerapps.io/entities/${id}/events/recordsdata'; i.e same case as defined in ocelot it worked. The docs mention that it is case-insensitive by default. Is this expected behavior in 23.4.0 or have i missed something.

Specifications

ggnaegi commented 1 week ago

@cmgchess Hello, thanks for your feedback, indeed, it might be a side effect of the new routing. Some Testcases are missing. Then, it's a bug, and we will provide a Hotfix. Thanks for your feedback!