Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Microsoft Releases YARP - Yet Another Reverse Proxy

Microsoft Releases YARP - Yet Another Reverse Proxy

This item in japanese

Lire ce contenu en français


Last year, in November, Microsoft released YARP (Yet Another Reverse Proxy), a reverse-proxy project developed during the last years by Microsoft as an open-source project.

A regular proxy is a software that acts as a gateway between the private network and the internet. It listens to outgoing HTTP requests, usually performing privacy or security-related tasks.

A reverse proxy works in the opposite way. It is usually set inside the local network, behind the firewall, and listens to incoming requests. It is often used as a router to redirect the incoming requests to a proper endpoint, which can happen when multiple web servers are running in one machine or even set up a load-balancing system.

Image source:

Reverse proxies work in the application layer (OSI layer 7), which means they can process the requests based on their URLs and headers, differently from physical routers or firewalls, which act on the transport layer (OSI layer 4).

As a reverse-proxy project can have a wide scope, it can be difficult to choose appropriate software for it, but developing a whole new application from scratch would also consume a lot of time. Based on these considerations, Microsoft came up with YARP, a toolkit that can be used to build custom reverse proxies using .NET.

YARP was written in C# by Microsoft's ASP.NET and network teams, and it offers several proxy-related features from which developers can take advantage. Routes can be defined using URL or HTTP headers; they can be set together with the destinations in the application config file or programmatically. For applications that only need to redirect requests, developers do not need to run a full YARP solution. There is a feature called direct forwarding, which can be used through the interface IHttpForwarder, which represents the core proxy adapter between incoming AspNetCore and outgoing System.Net.Http requests.

YARP has five load-balancing policies: FirstAlphabetical, Random, PowerOfTwoChoices (default), RoundRobin, and LeastRequests, which developers can pick up according to their needs.

Other features present on the reverse-proxy tool are destination health check, URL and  HTTP methods transformation, and measuring performance and logs to track down requests and their manipulation.

This is the first official release of YARP. Still, Microsoft has already listed features for future releases, like full support for HTTP 3, performance improvements, replacing the usage of HttpClient with LLHTTP, and integration with Kubernetes.

Microsoft does not have an actual support channel for YARP, but bugs and issues can be reported on GitHub. Security concerns should be reported privately, by reaching out to the Microsoft Security Response Center.

To get started with YARP, you just have to reference its NuGet package in your project and start coding according to your requirements. The project is open-source and it is compatible with .NET Core 3.1, .NET 5, and .NET 6. Therefore it can be used on Linux, macOS, and Windows operating systems. On the project's GitHub page, it is possible to find more information, like YARP's documentation, open and closed issues, and discussions about the just released reverse-proxy.

About the Author

Rate this Article