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.
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
