-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Labels
RoutingOcelot feature: RoutingOcelot feature: RoutingbugIdentified as a potential bugIdentified as a potential bugneeds validationIssue has not been replicated or verified yetIssue has not been replicated or verified yet
Description
After upgrading to Ocelot 23.4.3, query parameters whose names contain the substring id (e.g. customer_id) are incorrectly rewritten when another route with a {id} path parameter exists.
This causes query parameters to be corrupted and forwarded incorrectly to downstream services.
Routes Configuration
{
"Routes": [
{
"UpstreamPathTemplate": "/finance/v1/payment-methods/{id}",
"UpstreamHttpMethod": [ "Get" ],
"DownstreamPathTemplate": "/v1/payment-methods/{id}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5003
}
]
},
{
"UpstreamPathTemplate": "/finance/v1/payment-methods",
"UpstreamHttpMethod": [ "Get" ],
"DownstreamPathTemplate": "/v1/payment-methods",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 5003
}
]
}
]
}Steps to Reproduce
Call the second route with a query parameter:
GET /finance/v1/payment-methods?customer_id=5172980
Expected Behavior
Downstream request:
/v1/payment-methods?customer_id=5172980
Query parameters must remain unchanged.
Actual Behavior
Ocelot rewrites the query parameter:
/v1/payment-methods?customer5172980
The id substring in customer_id is incorrectly treated as a route token and removed.
Ocelot Version
- 23.4.3
Previously Working
- Yes (22.x and earlier 23.x)
Metadata
Metadata
Assignees
Labels
RoutingOcelot feature: RoutingOcelot feature: RoutingbugIdentified as a potential bugIdentified as a potential bugneeds validationIssue has not been replicated or verified yetIssue has not been replicated or verified yet