dotnet / dotnet/aspnetcore

Allow matching routes without capturing arguments

Open
#27,996 11 comments 1 reaction 0 assignees View on GitHub
area-mvc area-networking enhancement feature-routing feature-yarp Priority:1
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

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.

```C#
// 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.