Simple IP whitelisting #1663
-
Would like to restrict access to a given Route/Destination by the IP of the request. Basically deny if it didn't come from a specific server. I see how to do this with a custom scheme in aspnet middleware, was curious if there was an OOB way to do this using yarp config. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
I don't think there's any built-in IP-based routing support in ASP.NET Core. A quick search shows that the https://github.com/dustinmoris/Firewall package may be what you are looking for to easily add this as a middleware. |
Beta Was this translation helpful? Give feedback.
-
I had hope that: |
Beta Was this translation helpful? Give feedback.
-
This probably need to be handled by a custom YARP middleware in the proxy. Use the Metadata feature of config to add your own allow list for IP addresses for each route. In the middleware, you can access the route for each request, see if it has that metadata and if so then check the source IP against that data. |
Beta Was this translation helpful? Give feedback.
-
Duplicate of #1707 |
Beta Was this translation helpful? Give feedback.
Duplicate of #1707