Skip to content

Why is the last slash removed from the downstream URL in versions 23.x.x? #2279

Answered by raman-m
willsbctm asked this question in Q&A
Discussion options

You must be logged in to vote

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.

            "UpstreamPathTemplate": "/api/v1/endpoint-slash/{everything}",
            "DownstreamPathTemplate": "/v1/endpoint-slash/{everything}",

or with Catch All route:

            "UpstreamPathTemplate": "/api/{catchAll}",
            "DownstreamPathTemplate": "/{catchAll}",

Hope it helps!

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@willsbctm
Comment options

@raman-m
Comment options

@willsbctm
Comment options

@raman-m
Comment options

Answer selected by raman-m
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Routing Ocelot feature: Routing
2 participants
Converted from issue

This discussion was converted from issue #2278 on April 04, 2025 18:18.