dotnet / dotnet/aspnetcore

MapHost endpoint routing

Open
#19,354 7 comments 4 reactions 0 assignees View on GitHub
affected-few api-suggestion area-minimal area-mvc enhancement feature-routing severity-nice-to-have
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Describe the bug
In endpoint routing today routes are defined around paths. There's an additional constraint you can add for a host, but only after already defining a path. Instead what I want to do is map all requests to a specific host as the primary pivot. This can be done today but it is inelegant (I have to define a catch-all route), and in-efficient (route values would still be extracted).

### To Reproduce
Here's what I have to write today:
``` C#
endpoints.Map("/{**path}", handler).RequireHost(host);
```
Proposal:
``` C#
endpoints.MapHost(host, handler);
```

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.