-
The Expected BehaviorUsing version Ocelot 22.x.x with the following setup: {
"Routes": [
{
"DownstreamScheme": "http",
"UpstreamPathTemplate": "/api/v1/endpoint-slash",
"UpstreamHttpMethod": [
"Get"
],
"DownstreamPathTemplate": "/v1/endpoint-slash/",
"AuthenticationOptions": {
"AuthenticationProviderKey": "Jwt-IDM"
},
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 8885
}
]
}
]
} We got the slash at the end of the downtream applied path: Actual BehaviorUsing version Ocelot 23.x.x with the following setup: {
"Routes": [
{
"DownstreamScheme": "http",
"UpstreamPathTemplate": "/api/v1/endpoint-slash",
"UpstreamHttpMethod": [
"Get"
],
"DownstreamPathTemplate": "/v1/endpoint-slash/",
"AuthenticationOptions": {
"AuthenticationProviderKey": "Jwt-IDM"
},
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 8885
}
]
}
]
} We didn't get the slash at the end of the downtream applied path: Is that a problem or is that an expected behaviour? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Hello, Will! That is not a problem at all. It is expected behavior because Ocelot clears up the last slash. "UpstreamPathTemplate": "/api/v1/endpoint-slash/{everything}",
"DownstreamPathTemplate": "/v1/endpoint-slash/{everything}", or with Catch All route: "UpstreamPathTemplate": "/api/{catchAll}",
"DownstreamPathTemplate": "/{catchAll}", Hope it helps! |
Beta Was this translation helpful? Give feedback.
-
Related topic |
Beta Was this translation helpful? Give feedback.
Hello, Will!
That is not a problem at all. It is expected behavior because Ocelot clears up the last slash.
Additionally, Ocelot has many features related to path manipulation and slash workarounds.
Have you read these documents 👉 Routing Empty Placeholders ❔
If you want to keep the last slash, just define a Catch-All route and your slash will be preserved. Also, send URLs to upstream with the slash.
or with Catch All route:
Hope it helps!