Open
Description
We want MapGroup
to support middleware via the IApplicationBuilder
interface so things like UseResponseCompression()
, UseHttpLogging()
, UseForwardedHeaders()
, UseRequestLocalization()
, terminal middleware like UseStaticFiles()
and more can be called on a group.
Describe the solution you'd like
This still needs design, but there are a lot of open questions. We still need to figure out how we define a middleware that runs every time a route handler in a given group is hit. before running the endpoint and similar middleware from inner groups?
- How do we deal with middleware that checks the request path?
- Can we trim the group prefix from the path?
- What about middleware that's aware of grouping and wants the real full path?
- Do we add a new feature to support this?
- Can middleware use default endpoint metadata ([Route Groups] Add default metadata to endpoints exposing group structure #41429) to infer the real full path?
- What if no endpoint is matched, but the middleware would have been terminal?
- Do we create a low-priority catchall endpoint with the route prefix?
- Then what if the middleware isn't terminal?
- Can we still fallback to the normal missing endpoint logic if we add a fake catchall endpoint?
- Will we support middleware rewriting the route after matching a specific group prefix and rerun routing?
- This seems like too much. What if the new