A lightweight and simple reverse proxy middleware for ASP.NET Core applications. Enables routing and forwarding HTTP requests to configured destinations with support for request/response streaming.
$ dotnet add package SimpleReverseProxyA lightweight reverse proxy middleware for ASP.NET Core applications that allows forwarding requests to different destinations based on route configurations.
Install via NuGet Package Manager:
dotnet add package SimpleReverseProxy
Program.cs or Startup.cs:services.AddReverseProxy(Configuration.GetSection("ReverseProxy"));
app.UseSimpleReverseProxy();
appsettings.json:{
"ReverseProxy": {
"Sources": [
{
"DestinationId": "api1",
"Routes": [ "users", "products" ]
},
{
"DestinationId": "api2",
"Routes": [ "orders", "payments" ]
}
],
"Destinations": [
{
"DestinationId": "api1",
"Url": "https://api1.example.com"
},
{
"DestinationId": "api2",
"Url": "https://api2.example.com"
}
]
}
}
With this configuration:
/users and /products will be forwarded to https://api1.example.com/orders and /payments will be forwarded to https://api2.example.comMIT