Mục tiêu: Thiết kế API Gateway, hiểu Service Mesh, và implement distributed observability.
1. API Gateway
YARP (Yet Another Reverse Proxy) - Microsoft
csharp// .NET based reverse proxy, built by Microsoft
// Install: Yarp.ReverseProxy
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
app.MapReverseProxy();
json// appsettings.json
{
"ReverseProxy": {
"Routes": {
"orders-route": {
"ClusterId": "orders-cluster",
"Match": { "Path": "/api/orders/{**catch-all}" },