Closed phillip-haydon closed 2 years ago
Correct.
Didn’t know if that middleware. Could add some code to check if it’s set but a base module will work for now
On Mon, 25 May 2020 at 06:38, Phillip Haydon notifications@github.com wrote:
app.UseRouting(); app.UsePathBase("/api"); app.UseEndpoints(builder => builder.MapCarter());
When using Carter with a base path, it seems to ignore it. Do I have to go define this as a base module?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CarterCommunity/Carter/issues/247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAZVJROCPKNFCP32X2Z3SLRTH753ANCNFSM4NJHPLHA .
I believe it's built in. Doesn't need any special dependency.
It's strange tho, as it requires the route to begin with /
but routes in ASP.NET cannot start with /
@jchannon Looks like this still ignores UsePathBase
which we use for reverse proxies, do we need to create a base module to set a base path?
If this is on .NET6 then it I would have thought it would behave properly and use the base path however I've not checked how the minimal routing works with a base path.
If pre .NET6 then a base module should work
Yah it's .NET 6. I'll poke around
My guess with minimal apis is that you'll have to be explicit in the route definition which kinda sucks
On Mon, 10 Jan 2022 at 15:02, Jimmy Bogard @.***> wrote:
Yah it's .NET 6. I'll poke around
— Reply to this email directly, view it on GitHub https://github.com/CarterCommunity/Carter/issues/247#issuecomment-1008957904, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAZVJWSIY32KKVZ4NRNABTUVLYJHANCNFSM4NJHPLHA . You are receiving this because you were mentioned.Message ID: @.***>
It's not Carter, it's a thing with minimal routing:
https://github.com/dotnet/aspnetcore/issues/38448
Adding the call to UseRouting
fixed for me:
app.UsePathBase("/api");
app.UseRouting();
app.MapCarter();
When using Carter with a base path, it seems to ignore it. Do I have to go define this as a base module?