Microsoft releases a highly customizable reverse proxy YARP

A reverse proxy is used to monitor incoming HTTP requests and forward the request to the appropriate server for processing according to the requested content. However, a reverse proxy is different from firewalls and routers of layer 4 telecommunications. A reverse proxy is processed at layer 7 because it needs to understand HTTP and provide services based on HTTP.

There are many teams and projects within Microsoft that need to use a reverse proxy. Therefore, according to internal needs, Microsoft developed the YARP project, which allows users to highly customize it to meet the needs of specific scenarios.
YARP will process the HTTP link from the client when proxying the request, and then use itself to create a connection to the target server, so that both the client and the server can benefit from the connection pool.

As for the practical use, it is very extensive. A reverse proxy can act as the public end of one or a group of services and forward public requests to the back-end server for operation. This can either hide the actual URL or be used as a load balancer to balance the traffic between servers for optimal processing efficiency.

In the blog, Microsoft stated that the project has been in development for two years. In the beginning, it was because Microsoft observed that multiple internal teams had a need for reverse proxy, so they jointly developed a YARP solution. YARP is a reverse proxy toolkit that uses infrastructure from ASP.NET and .NET to build a high-performance reverse proxy in .NET. The feature of YARP is that it is very easy to customize settings. Users can customize configuration according to their actual needs or adjust to a tool that meets the needs of all scenarios.

The characteristic of YARP is that it is very easy to customize settings. Users can customize the configuration or adjust to meet the needs of the whole scene according to their actual needs.

YARP plugs into ASP.NET as middleware for handling incoming requests, and YARP offers two main paths for use & customization:

  • As a full featured proxy – YARP uses configuration to define a set of routes based on URL patterns, these routes map to clusters of destination servers, each destination in a cluster should be able to handle requests for the routes the cluster is mapped to. The destination list is filtered based on session affinity, and server health, then uses a load balancing algorithm to choose between the remaining destinations.Each part of this can be customized through configuration and customers can add additional modules, or replace stock modules as needed. The configuration system is extensible so for example route and destination information can be pulled from a source such as Service Fabric.
  • Alternatively, for highly custom environments the YARP request forwarder can be called directly, bypassing the routing, load-balancing modules etc. For example, this is how YARP is being used by Azure App Service for routing requests to specific instances, where the instances are spun up on demand.