ConfigsMay 23, 2026·3 min read

YARP — High-Performance Reverse Proxy Toolkit for .NET

A toolkit for building fast, customizable reverse proxy servers in .NET using the ASP.NET Core infrastructure, developed by Microsoft.

Agent ready

This asset can be read and installed directly by agents

TokRepo exposes a universal CLI command, install contract, metadata JSON, adapter-aware plan, and raw content links so agents can judge fit, risk, and next actions.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
YARP Overview
Universal CLI install command
npx tokrepo install cfa49c19-56c4-11f1-9bc6-00163e2b0d79

Introduction

YARP (Yet Another Reverse Proxy) is a library for building reverse proxy servers in .NET. Unlike standalone proxy binaries, YARP runs as middleware inside an ASP.NET Core application, giving developers full control over routing, transforms, and load balancing through code and configuration.

What YARP Does

  • Routes incoming HTTP requests to backend clusters based on path, headers, or query strings
  • Balances load across multiple destination servers with built-in algorithms
  • Transforms request and response headers, paths, and query strings
  • Supports health checking to remove unhealthy backends from rotation
  • Enables session affinity for stateful backend services

Architecture Overview

YARP runs as ASP.NET Core middleware in the request pipeline. It reads route and cluster configuration from appsettings.json, code, or custom providers. For each incoming request, YARP matches it to a route, selects a destination from the cluster using load balancing, applies request transforms, forwards the call via HttpClient, and applies response transforms on the way back. The entire pipeline is async and uses Kestrel for high-throughput proxying.

Self-Hosting & Configuration

  • Install via NuGet: dotnet add package Yarp.ReverseProxy
  • Define routes and clusters in appsettings.json or via code-based configuration
  • Add health check endpoints to automatically remove failing backends
  • Apply request/response transforms for header rewriting and path modification
  • Supports dynamic configuration providers that reload without restart

Key Features

  • Code-level extensibility through ASP.NET Core middleware pipeline
  • Multiple load balancing algorithms: round robin, least requests, random, power of two choices
  • Active and passive health checking with configurable thresholds
  • Header, path, and query string transforms without custom code
  • Direct HTTP/2 and gRPC proxying support

Comparison with Similar Tools

  • Nginx — standalone reverse proxy written in C; more mature, less programmable from .NET
  • Envoy — cloud-native L7 proxy; broader feature set, requires sidecar deployment
  • Traefik — auto-discovery reverse proxy; strong Docker/K8s integration, not embeddable in .NET
  • HAProxy — high-performance TCP/HTTP proxy; battle-tested, no .NET integration
  • Ocelot — .NET API gateway; similar concept but older architecture, less active development

FAQ

Q: When should I use YARP instead of Nginx or Traefik? A: Use YARP when you need to embed proxy logic inside a .NET application, apply custom C# transforms, or integrate with existing ASP.NET Core middleware like authentication and rate limiting.

Q: Can YARP handle gRPC traffic? A: Yes. YARP supports proxying HTTP/2 traffic including gRPC without additional configuration.

Q: Does YARP support dynamic configuration changes? A: Yes. YARP provides an IProxyConfigProvider interface for custom configuration sources and supports live reload without application restart.

Q: How does YARP compare to Ocelot? A: YARP is developed by Microsoft, uses modern ASP.NET Core primitives, and targets high-throughput scenarios. Ocelot is a community project with a broader feature set for API gateway patterns but uses an older architecture.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets