liveBook · Manning

YARP

As explained in ASP.NET Core in Action, 3e

YARP is a .NET library and proxy toolkit for building high-performance customizable reverse proxies.

YARP (Yet Another Reverse Proxy) is an ASP.NET Core-based .NET library for building a reverse proxy. It receives internet-facing requests and forwards them to the appropriate web server, keeping the underlying application server behind the proxy. section 2.4.2

A reverse-proxy arrangement separates public-facing concerns from application concerns. The proxy can be hardened against internet threats and handle operational work while Kestrel focuses on generating HTTP responses. section 2.4.2

YARP is useful when you need to:

  • Build your own reverse proxy instead of relying on IIS, NGINX, HAProxy, or Apache. section 2.4.2
  • Migrate an existing ASP.NET application gradually by routing one page or API at a time. section 2.4.3
  • Keep the same ASP.NET Core web server behind different proxy implementations across operating systems. section 2.4.2

Incremental application migration

Place YARP in front of an existing ASP.NET application and redirect selected pages or APIs through the new ASP.NET Core application. Expand the routed surface gradually rather than converting the entire application at once. section 2.4.3

Figure 2.6 The difference between hosting models in ASP.NET (top) and ASP.NET Core (bottom). In the previous version of ASP.NET, IIS is tightly coupled with the application. The hosting model in ASP.NET Core is simpler; IIS hands off the request to a self-hosted web server in the ASP.NET Core application and receives the response but has no deeper knowledge of the application.
CH02_F06_Lock3

Compare the tightly coupled ASP.NET hosting model with ASP.NET Core's self-hosted web server behind a reverse proxy. section 2.4.2

How ASP.NET Core in Action, 3e covers it

How deep it goes
Defines request forwarding, hosting separation, and migration use, but stops short of configuration or implementation details.
Examples
Uses page-by-page and API-by-API migration, plus contrasting IIS and self-hosted ASP.NET Core hosting models.
What it assumes
Assumes familiarity with ASP.NET applications and web-server hosting while introducing reverse-proxy responsibilities and deployment separation.
What you can do after
Apply it via YARP to place a proxy before an application or migrate routes incrementally to ASP.NET Core.
How it connects
Connects reverse proxies with ASP.NET Core, Kestrel, IIS, NGINX, HAProxy, Apache, and the strangler fig pattern.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.