Skip to content

[Route Groups] Implement IApplicationBuilder to support grouped middleware #41431

Open
@halter73

Description

@halter73

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?
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etc

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions