projects/yarp/basic-demo/Readme.md
This demo showcases creating reverse proxy in asp.net core by making use of YARP package. From the official documentation here, YARP is:
A library to help create reverse proxy servers that are high-performance, production-ready, and highly customizable
https://localhost:9004;http://localhost:9005.https://localhost:9002;http://localhost:9003.https://localhost:9000;http://localhost:9001."ReverseProxy": {
"Routes": {
"allrouteprops": {
"ClusterId": "allclusterprops",
"Match": {
"Path": "{**catch-all}"
}
},
"api": {
"ClusterId": "api",
"Match": {
"Path": "/api/{**slug}"
}
}
},
"Clusters": {
"allclusterprops": {
"Destinations": {
"frontend": {
"Address": "https://localhost:9002"
}
}
},
"api": {
"Destinations": {
"backend": {
"Address": "https://localhost:9004"
}
}
}
}
}
Program.cs
var builder = WebApplication.CreateBuilder(args);
var yarpConfigSection = builder.Configuration.GetSection("ReverseProxy");
builder.Services.AddReverseProxy()
.LoadFromConfig(yarpConfigSection);
var app = builder.Build();
app.MapReverseProxy();
app.Run();
Yarp.Demo.BackEnd
dotnet run.Yarp.Demo.FrontEnd
dotnet run.Yarp.Demo.Proxy
dotnet run.https://localhost:9000Main Page
Proxy Logs