Skip to content

Allow matching routes without capturing arguments #27996

Open
@davidfowl

Description

@davidfowl

For proxy scenarios where routes need to be parameterized for matching but not for capture support a syntax to avoid allocating anything after matching.

e.g.

// ProxyRequest is a made up method that proxies the HttpRequest to another server

endpoints.Map("/api/v1/{*path}", context =>
{
     return context.ProxyRequest("http://localhost/old/" + context.Request.Path);
});

endpoints.Map("/api/v2/{*path}", context =>
{
     return context.ProxyRequest("http://localhost/new/" + context.Request.Path);
});

cc @Tratcher

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority:1Work that is critical for the release, but we could probably ship withoutarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-routingfeature-yarpThis issue is related to work on yarp

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions