Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/ab-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: A/B Testing and Rolling Upgrades
description: A/B Testing and Rolling Upgrades
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/authn-authz.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Authentication and Authorization
description: Authentication and Authorization
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
8 changes: 4 additions & 4 deletions aspnetcore/fundamentals/servers/yarp/config-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Configuration Files
description: Configuration Files
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down Expand Up @@ -37,7 +37,7 @@ app.Run();
```
**Note**: For details about middleware ordering see [here](/aspnet/core/fundamentals/middleware/#middleware-order).

Configuration can be modified during the load sequence using [Configuration Filters](config-filters.md).
Configuration can be modified during the load sequence using [Configuration Filters](xref:fundamentals/servers/yarp/config-filters).

## Multiple Configuration Sources
As of 1.1, YARP supports loading the proxy configuration from multiple sources. LoadFromConfig may be called multiple times referencing different IConfiguration sections or may be combine with a different config source like InMemory. Routes can reference clusters from other sources. Note merging partial config from different sources for a given route or cluster is not supported.
Expand Down Expand Up @@ -95,7 +95,7 @@ The routes section is an unordered collection of route matches and their associa
- Match - contains either a Hosts array or a Path pattern string. Path is an ASP.NET Core route template that can be defined as [explained here](/aspnet/core/fundamentals/routing#route-templates).
Route matching is based on the most specific routes having highest precedence as described [here](/aspnet/core/fundamentals/routing#url-matching). Explicit ordering can be achieved using the `order` field, with lower values taking higher priority.

[Headers](header-routing.md), [Authorization](authn-authz.md), [CORS](cors.md), and other route based policies can be configured on each route entry. For additional fields see [RouteConfig](xref:Yarp.ReverseProxy.Configuration.RouteConfig).
[Headers](xref:fundamentals/servers/yarp/header-routing), [Authorization](xref:fundamentals/servers/yarp/authn-authz), [CORS](xref:fundamentals/servers/yarp/cors), and other route based policies can be configured on each route entry. For additional fields see [RouteConfig](xref:Yarp.ReverseProxy.Configuration.RouteConfig).

The proxy will apply the given matching criteria and policies, and then pass off the request to the specified cluster.

Expand Down Expand Up @@ -234,4 +234,4 @@ For additional fields see [ClusterConfig](xref:Yarp.ReverseProxy.Configuration.C
}
```

For more information see [logging configuration](diagnosing-yarp-issues.md#logging) and [HTTP client configuration](http-client-config.md).
For more information see [logging configuration](diagnosing-yarp-issues.md#logging) and [HTTP client configuration](xref:fundamentals/servers/yarp/http-client-config).
4 changes: 2 additions & 2 deletions aspnetcore/fundamentals/servers/yarp/config-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Configuration Filters
description: Configuration Filters
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand All @@ -13,7 +13,7 @@ ai-usage: ai-assisted
# Configuration Filters

## Introduction
YARP configuration for routes, clusters, and destinations can be loaded from [configuration files](config-files.md) or from [configuration providers](config-providers.md). Configuration filters can be used to modify that raw input before it's validated and applied.
YARP configuration for routes, clusters, and destinations can be loaded from [configuration files](xref:fundamentals/servers/yarp/config-files) or from [configuration providers](xref:fundamentals/servers/yarp/config-providers). Configuration filters can be used to modify that raw input before it's validated and applied.

Filters can be used for a variety of purposes such as:
- Supplementing config fields with data from other sources like the deployment environment
Expand Down
6 changes: 3 additions & 3 deletions aspnetcore/fundamentals/servers/yarp/config-providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Extensibility Configuration Providers
description: Extensibility Configuration Providers
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand All @@ -17,7 +17,7 @@ The [Basic Yarp Sample](https://github.com/microsoft/reverse-proxy/tree/main/sam

See [ReverseProxy.Code.Sample](https://github.com/microsoft/reverse-proxy/tree/main/samples/ReverseProxy.Code.Sample) for an example of a custom configuration provider.

Configuration can be modified during the load sequence using [Configuration Filters](config-filters.md).
Configuration can be modified during the load sequence using [Configuration Filters](xref:fundamentals/servers/yarp/config-filters).

## Structure
[IProxyConfigProvider](xref:Yarp.ReverseProxy.Configuration.IProxyConfigProvider) has a single method `GetConfig()` that should return an [IProxyConfig](xref:Yarp.ReverseProxy.Configuration.IProxyConfig) instance. The IProxyConfig has lists of the current routes and clusters, as well as an `IChangeToken` to notify the proxy when this information is out of date and should be reloaded, which will cause `GetConfig()` to be called again.
Expand All @@ -28,7 +28,7 @@ The routes section is an unordered collection of named routes. A route contains
- ClusterId - refers to the name of an entry in the clusters section.
- Match - contains either a Hosts array or a Path pattern string. Path is an ASP.NET Core route template that can be defined as [explained here](/aspnet/core/fundamentals/routing#route-templates).

[Headers](header-routing.md), [Authorization](authn-authz.md), [CORS](cors.md), and other route based policies can be configured on each route entry. For additional fields see [RouteConfig](xref:Yarp.ReverseProxy.Configuration.RouteConfig).
[Headers](xref:fundamentals/servers/yarp/header-routing), [Authorization](xref:fundamentals/servers/yarp/authn-authz), [CORS](xref:fundamentals/servers/yarp/cors), and other route based policies can be configured on each route entry. For additional fields see [RouteConfig](xref:Yarp.ReverseProxy.Configuration.RouteConfig).

The proxy will apply the given matching criteria and policies, and then pass off the request to the specified cluster.

Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/cors.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Cross-Origin Requests (CORS)
description: Cross-Origin Requests (CORS)
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Extensibility Destination Resolvers
description: Extensibility Destination Resolvers
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Destination health checks
description: Destination health checks
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Diagnosing YARP-based proxies
description: Diagnosing YARP-based proxies
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/direct-forwarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Direct Forwarding
description: Direct Forwarding
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
4 changes: 2 additions & 2 deletions aspnetcore/fundamentals/servers/yarp/distributed-tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Distributed tracing
description: Distributed tracing
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand All @@ -28,7 +28,7 @@ These will only be created if there is a listener for the [`ActivitySource`](/do

### Example: Application Insights

For example, to monitor the traces with Application Insights, the proxy application needs to use the [Open Telemetry](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry/README.md) and [Azure Monitor](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/README.md) SDKs.
For example, to monitor the traces with Application Insights, the proxy application needs to use the [Open Telemetry](xref:fundamentals/servers/yarp/https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry/README) and [Azure Monitor](xref:fundamentals/servers/yarp/https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/README) SDKs.

`application.csproj`:

Expand Down
6 changes: 3 additions & 3 deletions aspnetcore/fundamentals/servers/yarp/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Getting Started with YARP
description: Getting Started with YARP
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down Expand Up @@ -59,9 +59,9 @@ app.Run();

## Configuration

The configuration for YARP is defined in the appsettings.json file. See [Configuration Files](config-files.md) for details.
The configuration for YARP is defined in the appsettings.json file. See [Configuration Files](xref:fundamentals/servers/yarp/config-files) for details.

The configuration can also be provided programmatically. See [Configuration Providers](config-providers.md) for details.
The configuration can also be provided programmatically. See [Configuration Providers](xref:fundamentals/servers/yarp/config-providers) for details.

You can find out more about the available configuration options by looking at [RouteConfig](xref:Yarp.ReverseProxy.Configuration.RouteConfig) and [ClusterConfig](xref:Yarp.ReverseProxy.Configuration.ClusterConfig).

Expand Down
6 changes: 3 additions & 3 deletions aspnetcore/fundamentals/servers/yarp/grpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Proxing gRPC
description: Proxing gRPC
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down Expand Up @@ -59,7 +59,7 @@ This shows configuring the outgoing proxy request to use HTTP/2 over http.

[gRPC-Web](https://grpc.io/docs/platforms/web/basics/) is an alternative wire-format for gRPC that's compatible with HTTP/1.1.

* [`application/grpc`](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md) - gRPC over HTTP/2 is how gRPC is typically used.
* [`application/grpc-web`](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB.md) - gRPC-Web modifies the gRPC protocol to be compatible with HTTP/1.1. gRPC-Web can be used in more places. gRPC-Web can be used by browser apps and in networks without complete support for HTTP/2. Two advanced gRPC features are not supported: client streaming and bidirectional streaming.
* [`application/grpc`](xref:fundamentals/servers/yarp/https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2) - gRPC over HTTP/2 is how gRPC is typically used.
* [`application/grpc-web`](xref:fundamentals/servers/yarp/https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-WEB) - gRPC-Web modifies the gRPC protocol to be compatible with HTTP/1.1. gRPC-Web can be used in more places. gRPC-Web can be used by browser apps and in networks without complete support for HTTP/2. Two advanced gRPC features are not supported: client streaming and bidirectional streaming.

gRPC-Web can be proxied by YARP's default configuration without any special considerations.
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/header-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: HTTP Headers
description: HTTP Headers
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
9 changes: 2 additions & 7 deletions aspnetcore/fundamentals/servers/yarp/header-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@ title: Header Based Routing
description: Header Based Routing
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
---

---
uid: header-routing
title: Header Based Routing
---

# Header Based Routing

Proxy routes specified in [config](config-files.md) or via [code](config-providers.md) must include at least a path or host to match against. In addition to these, a route can also specify one or more headers that must be present on the request.
Proxy routes specified in [config](xref:fundamentals/servers/yarp/config-files) or via [code](xref:fundamentals/servers/yarp/config-providers) must include at least a path or host to match against. In addition to these, a route can also specify one or more headers that must be present on the request.

### Precedence

Expand Down
4 changes: 2 additions & 2 deletions aspnetcore/fundamentals/servers/yarp/http-client-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: HTTP Client Configuration
description: HTTP Client Configuration
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down Expand Up @@ -162,7 +162,7 @@ The below example shows 2 samples of HTTP client and request configurations for
## Code Configuration
HTTP client configuration uses the type [HttpClientConfig](xref:Yarp.ReverseProxy.Configuration.HttpClientConfig).

The following is an example of `HttpClientConfig` using [code based](config-providers.md) configuration. An instance of `HttpClientConfig` is assigned to the [ClusterConfig.HttpClient](xref:Yarp.ReverseProxy.Configuration.ClusterConfig) property before passing the cluster array to `LoadFromMemory` method.
The following is an example of `HttpClientConfig` using [code based](xref:fundamentals/servers/yarp/config-providers) configuration. An instance of `HttpClientConfig` is assigned to the [ClusterConfig.HttpClient](xref:Yarp.ReverseProxy.Configuration.ClusterConfig) property before passing the cluster array to `LoadFromMemory` method.

```C#
var routes = new[]
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/http3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: HTTP/3
description: HTTP/3
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
6 changes: 3 additions & 3 deletions aspnetcore/fundamentals/servers/yarp/https-tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: HTTPS & TLS
description: HTTPS & TLS
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down Expand Up @@ -36,6 +36,6 @@ To enable TLS encryption when communicating with a destination specify the desti

The host name specified in the destination address will be used for the TLS handshake by default, including SNI and server certificate validation. If proxying the [original host header](transforms.md#requestheaderoriginalhost) is enabled, that value will be used for the TLS handshake instead. If a custom host value needs to be used then use the [RequestHeader](transforms.md#requestheader) transform to set the host header.

Outbound connections to the destinations are handled by HttpClient/SocketsHttpHandler. A different instance and settings can be configured per cluster. Some settings are available in the configuration model, while others can only be configured in code. See the [HttpClient](http-client-config.md) docs for details.
Outbound connections to the destinations are handled by HttpClient/SocketsHttpHandler. A different instance and settings can be configured per cluster. Some settings are available in the configuration model, while others can only be configured in code. See the [HttpClient](xref:fundamentals/servers/yarp/http-client-config) docs for details.

Destination server certificates need to be trusted by the proxy or custom validation needs to be applied via the [HttpClient](http-client-config.md) configuration.
Destination server certificates need to be trusted by the proxy or custom validation needs to be applied via the [HttpClient](xref:fundamentals/servers/yarp/http-client-config) configuration.
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/httpsys-delegation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Http.sys Delegation
description: Http.sys Delegation
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/kubernetes-ingress.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Kubernetes Ingress Controller
description: Kubernetes Ingress Controller
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/lets-encrypt.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Lets Encrypt
description: Lets Encrypt
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
2 changes: 1 addition & 1 deletion aspnetcore/fundamentals/servers/yarp/load-balancing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Load Balancing
description: Load Balancing
author: rick-anderson
ms.author: riande
ms.date: 02/06/2025
ms.date: 2/6/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
Expand Down
Loading
Loading