dotnet / dotnet/AspNetCore.Docs

YARP Extensibility overview

Open
#34,690 0 comments 0 reactions 0 assignees View on GitHub
:bomb: vanQUEST seQUESTered
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

In reviewing the content we want for a marketing site for YARP, I realized with @adityamandaleeka that content I wanted in the site should probably be in the docs instead. The topic is a high level overview of extensibility options in YARP, and should be the top topic under extensibility, something along the lines of:

----

# YARP Extensibility

There are 2 main styles of extensibility for YARP, depending on the routing behavior that you want.

* Middleware Pipeline
* Http Forwarder

## Middleware pipeline

YARP uses the concept of [Routes](config-files.md#routes), [Clusters](config-files.md#clusters) and Destinations. These can be supplied through [configuration files](config-files.md) or [directly through code](config-providers.md). Based on the routing rules, YARP picks a cluster and enumerates the possible destinations. It then uses the middleware pipeline to select the destination based on destination health, session affinity, load balancing etc.

![Image](https://github.com/user-attachments/assets/ff17a04f-0c3c-46c7-8ec2-a1ed3dbc948c)

Most of the pre-built pipeline modules can be customized through code. You can also change the pipeline definition to replace modules with your own implementation(s) or add additional modules as needed.

See [Middleware](middleware.md) for more information.

## Http Forwarder
If the YARP pipeline is too rigid for your needs, or the scale of routing rules and destinations is not suitable for loading into memory, then you can implement your own routing logic and use the HTTP Forwarder to direct requests to your chosen destination. The HttpForwarder component takes the HTTP context and forwards the request to the supplied destination.

![Image](https://github.com/user-attachments/assets/1a060a7e-fa43-49a4-bfad-f95d7d35be63)

The transform component can still be used with the forwarder is needed.

See [Direct forwarding](direct-forwarding.md) for more information.

What would be cool is if the diagrams could be made into links for the respective sections for more information on each component?

-------

Page URL: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/yarp/extensibility?view=aspnetcore-9.0
Content source URL:
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/servers/yarp/extensibility.md

Document ID: a90fd9cd-e22e-e600-e669-5a0d8be25878

---
[Associated WorkItem - 372045](https://dev.azure.com/msft-skilling/Content/_workitems/edit/372045)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.