You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works great, and now a endpoint method mapped to /foo/bar is actually mapped to /api/foo/bar. However...it seems there still exists a mapping for /foo/bar.
Take this example controller in a project I'm working on:
In Postman, I am able to make a PUT request to /api/upload/oid/{oid}, and /upload/oid/{oid}.
Expected Behavior
Using UsePathBase() should not preserve the original controller routing configuration (IE, what the routing would be if UsePathBase() had never been called).
Steps To Reproduce
app.UsePathBase("/api");app.UseRouting();
Then add any applicable controllers. (I am using a Web API template project, so I'm unsure what other code is specific to my project and not just the defaults).
If needed I can create a brand new project and put it on GitHub.
Exceptions (if any)
N/A
.NET Version
7.0.102
Anything else?
JetBrains Rider, project is targeting net7.0. Referenced packages, if of any use:
Woops, I neglected to search through closed issues as well. Seems to be a duplicate of #45076 - it would be nice, if not already the case, to document this behavior, because it doesn't seem intuitive at all to me, that both endpoints function after using this middleware. I will look into what this new 7.0 route groups feature is and hope it can work for my use case.
Is there an existing issue for this?
Describe the bug
After some research and testing to find a way to globally prefix my API routes with
/api
, I have arrived at the following code:This works great, and now a endpoint method mapped to
/foo/bar
is actually mapped to/api/foo/bar
. However...it seems there still exists a mapping for/foo/bar
.Take this example controller in a project I'm working on:
In Postman, I am able to make a PUT request to


/api/upload/oid/{oid}
, and/upload/oid/{oid}
.Expected Behavior
Using
UsePathBase()
should not preserve the original controller routing configuration (IE, what the routing would be ifUsePathBase()
had never been called).Steps To Reproduce
Then add any applicable controllers. (I am using a Web API template project, so I'm unsure what other code is specific to my project and not just the defaults).
If needed I can create a brand new project and put it on GitHub.
Exceptions (if any)
N/A
.NET Version
7.0.102
Anything else?
JetBrains Rider, project is targeting
net7.0
. Referenced packages, if of any use:The text was updated successfully, but these errors were encountered: