Fast, flexible, and easy to extend—YARP lets you build a reverse proxy tailored to your needs in just a few lines of code.
Configure and extend with just a few lines of .NET code.
Fine-grained control over routing, load balancing, and health checks.
Supports gRPC, WebSockets, HTTP/2, and HTTP/3.
YARP is used by teams at Microsoft to handle billions of requests daily, powering services at massive scale.
Check out our full Getting Started tutorial, or dive right in with some code or a pre-built container.
Get started with YARP using a code-first approach. This snippet sets up a basic reverse proxy.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
var app = builder.Build();
app.MapReverseProxy();
app.Run();
Put the following configuration in appsettings.json
. YARP supports loading configuration from any IConfiguration provider. See Configuration Files for more details.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"ReverseProxy": {
"Routes": {
"route1": {
"ClusterId": "cluster1",
"Match": {
"Path": "{**catch-all}"
}
}
},
"Clusters": {
"cluster1": {
"Destinations": {
"destination1": {
"Address": "https://example.com/"
}
}
}
}
}
}