dotnet / dotnet/aspnetcore

Add IP range support to AllowedHosts

Open
#41,702 12 comments 5 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 5h
Merged PRs (30d)
276

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Currently allowed hosts (host filtering middleware) only allows to set an exact ip address. It would be very useful if it can support an ip range (ie. 172.28.0.0/16). An example use case can be an automatic scaling scenario where the exact ip address of the newly spun up instance is not known.

### Describe the solution you'd like

Would be helpful if we can define an ip range within the allowed hosts configuration settings.

For example:
`"AllowedHosts": "mydomain.com;172.28.0.0/16"`

An implementation I would like to have can be found here https://gist.github.com/akotranza/8d6539ac378087ac703dde3ec6b74308

### Additional context

_No response_

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.