Loading...
Loading...
Configures YARP reverse proxy for API gateway routing. Use when: Setting up API gateway routes, configuring path transformations, proxying requests to backend services, or aggregating microservice endpoints.
npx skill4agent add stuartf303/sorcha yarpMapReverseProxy()// Program.cs - Add YARP with configuration-based routes
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
// CRITICAL: MapReverseProxy() must be called LAST
app.MapReverseProxy();{
"ReverseProxy": {
"Routes": {
"blueprint-route": {
"ClusterId": "blueprint-cluster",
"Match": { "Path": "/api/blueprint/{**catch-all}" },
"Transforms": [{ "PathPattern": "/api/{**catch-all}" }]
}
},
"Clusters": {
"blueprint-cluster": {
"Destinations": {
"destination1": { "Address": "http://blueprint-service:8080" }
}
}
}
}
}| Concept | Usage | Example |
|---|---|---|
| Route | Maps external path to cluster | |
| Cluster | Backend service destination(s) | |
| Transform | Rewrites path before forwarding | |
| Catch-all | Captures remaining path segments | |
{
"Match": { "Path": "/api/blueprint/{**catch-all}" },
"Transforms": [{ "PathPattern": "/api/{**catch-all}" }]
}GET /api/blueprint/blueprintsGET /api/blueprints{
"blueprint-status-route": {
"ClusterId": "blueprint-cluster",
"Match": { "Path": "/api/blueprint/status" },
"Transforms": [{ "PathPattern": "/api/health" }]
}
}"Transforms": [
{ "PathPattern": "/api/{**catch-all}" },
{ "X-Forwarded": "Set" }
]Fetch latest YARP documentation with Context7.
mcp__context7__resolve-library-idmcp__context7__query-docs/dotnet/yarp