Skip to content

Commit a9b7f00

Browse files
Corrected some spelling/wording in YARP node (#35127)
1 parent 634bab5 commit a9b7f00

File tree

13 files changed

+294
-247
lines changed

13 files changed

+294
-247
lines changed

aspnetcore/fundamentals/servers/yarp/diagnosing-yarp-issues.md

Lines changed: 71 additions & 53 deletions
Large diffs are not rendered by default.

aspnetcore/fundamentals/servers/yarp/extensibility-transforms.md

Lines changed: 74 additions & 49 deletions
Large diffs are not rendered by default.

aspnetcore/fundamentals/servers/yarp/extensibility.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ ms.topic: article
99
content_well_notification: AI-contribution
1010
ai-usage: ai-assisted
1111
---
12-
1312
# Overview of YARP extensibility
1413

1514
There are 2 main styles of extensibility for YARP, depending on the routing behavior desired:
@@ -23,24 +22,24 @@ YARP uses the concept of [Routes](xref:fundamentals/servers/yarp/config-files#ro
2322

2423
![Middleware pipeline diagram](~/fundamentals/servers/yarp/media/yarp-pipeline.png)
2524

26-
Most of the pre-built pipeline can be customized through code:
25+
Most of the prebuilt pipeline can be customized through code:
2726

28-
- [Configuration Providers](xref:fundamentals/servers/yarp/config-providers)
29-
- [Destination Enumeration](xref:fundamentals/servers/yarp/destination-resolvers)
30-
- [Session Affinity](xref:fundamentals/servers/yarp/session-affinity)
31-
- [Load Balancing](xref:fundamentals/servers/yarp/load-balancing)
32-
- [Health Checks](xref:fundamentals/servers/yarp/dests-health-checks)
33-
- [Request Transforms](xref:fundamentals/servers/yarp/transform-extensibility)
34-
- [HttpClient configuration](./http-client-config.md#code-configuration)
27+
* [Configuration Providers](xref:fundamentals/servers/yarp/config-providers)
28+
* [Destination Enumeration](xref:fundamentals/servers/yarp/destination-resolvers)
29+
* [Session Affinity](xref:fundamentals/servers/yarp/session-affinity)
30+
* [Load Balancing](xref:fundamentals/servers/yarp/load-balancing)
31+
* [Health Checks](xref:fundamentals/servers/yarp/dests-health-checks)
32+
* [Request Transforms](xref:fundamentals/servers/yarp/transform-extensibility)
33+
* [HttpClient configuration](./http-client-config.md#code-configuration)
3534

3635
You can also change the pipeline definition to replace modules with your own implementation(s) or add additional modules as needed. For more information see [Middleware](xref:fundamentals/servers/yarp/middleware).
3736

38-
## Http Forwarder
37+
## HTTP Forwarder
3938

40-
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.
39+
If the YARP pipeline is too rigid for your use case or the scale of routing rules and destinations isn't 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.
4140

4241
![HTTP forwarder diagram](~/fundamentals/servers/yarp/media/yarp-forwarder.png)
4342

44-
The transform component can still be used with the forwarder is needed.
43+
The transform component can still be used if the forwarder is needed.
4544

4645
For more information see [Direct forwarding](xref:fundamentals/servers/yarp/direct-forwarding).

aspnetcore/fundamentals/servers/yarp/getting-started.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ ms.topic: article
99
content_well_notification: AI-contribution
1010
ai-usage: ai-assisted
1111
---
12+
# Getting started with YARP
1213

13-
# Getting Started with YARP
14-
15-
YARP is designed as a library that provides the core proxy functionality which you can then customize by adding or replacing modules. YARP is currently provided as a NuGet package and code snippets. We plan on providing a project template and prebuilt executable (`.exe`) in the future.
14+
YARP is designed as a library that provides the core proxy functionality, which you can customize by adding or replacing modules. YARP is currently provided as a NuGet package and code samples. We plan on providing a project template and prebuilt executable (`.exe`) in the future.
1615

1716
YARP is implemented on top of .NET Core infrastructure and is usable on Windows, Linux or MacOS. Development can be done with the SDK and your favorite editor, [Microsoft Visual Studio](https://visualstudio.microsoft.com/vs/) or [Visual Studio Code](https://code.visualstudio.com/).
1817

@@ -24,7 +23,7 @@ You can download the .NET SDK from https://dotnet.microsoft.com/download/dotnet/
2423

2524
A complete version of the project built using the steps below can be found at [Basic YARP Sample](https://github.com/microsoft/reverse-proxy/tree/release/latest/samples/BasicYarpSample).
2625

27-
Start by creating an "Empty" ASP.NET Core application using the command line:
26+
Start by creating an empty ASP.NET Core application using the command line:
2827

2928
```dotnetcli
3029
dotnet new web -n MyProxy
@@ -97,6 +96,6 @@ Learn more about the available configuration options by looking at <xref:Yarp.Re
9796

9897
## Run the project
9998

100-
When using the .NET CLU, use `dotnet run` called within the sample's directory or `dotnet run --project <path to .csproj file>`.
99+
When using the .NET CLI, use `dotnet run` within the sample's directory or `dotnet run --project <path to .csproj file>`.
101100

102-
In Visual Studio, start the app with the **Run** button.
101+
In Visual Studio, start the app by clicking the **Run** button.

aspnetcore/fundamentals/servers/yarp/grpc.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
22
uid: fundamentals/servers/yarp/grpc
3-
title: YARP Proxing gRPC
4-
description: YARP Proxing gRPC
3+
title: YARP Proxying gRPC
4+
description: YARP Proxying gRPC
55
author: samsp-msft
66
ms.author: samsp
77
ms.date: 2/6/2025
88
ms.topic: article
99
content_well_notification: AI-contribution
1010
ai-usage: ai-assisted
1111
---
12-
13-
# YARP Proxing gRPC
12+
# YARP Proxying gRPC
1413

1514
## Introduction
1615

@@ -20,9 +19,10 @@ ai-usage: ai-assisted
2019

2120
gRPC requires HTTP/2 for most scenarios. HTTP/1.1 and HTTP/2 are enabled by default on ASP.NET Core servers (YARP's front end) but they require https (TLS) for HTTP/2 so YARP needs to be listening on a `https://` URL.
2221

23-
HTTP/2 over http (non-TLS) is only supported on Kestrel and requires specific settings. For details see [here](/aspnet/core/grpc/aspnetcore#server-options).
22+
HTTP/2 over http (non-TLS) is only supported on Kestrel and requires specific settings. For more information, see <xref:grpc/aspnetcore#server-options>.
2423

2524
This shows configuring Kestrel to use HTTP/2 over http (non-TLS):
25+
2626
```json
2727
{
2828
"Kestrel": {
@@ -38,9 +38,10 @@ This shows configuring Kestrel to use HTTP/2 over http (non-TLS):
3838

3939
## Configure YARP's Outgoing Protocols
4040

41-
YARP automatically negotiates HTTP/1.1 or HTTP/2 for outgoing proxy requests, but only for https (TLS). HTTP/2 over http (non-TLS) requires additional settings. Note outgoing protocols are independent of incoming ones. E.g. https can be used for the incoming connection and http for the outgoing one, this is called TLS termination. See [here](http-client-config.md#httprequest) for configuration details.
41+
YARP automatically negotiates HTTP/1.1 or HTTP/2 for outgoing proxy requests, but only for https (TLS). HTTP/2 over http (non-TLS) requires additional settings. Note that outgoing protocols are independent of incoming ones. E.g. https can be used for the incoming connection and http for the outgoing one, this is called TLS termination. For configuration details, see <xref:fundamentals/servers/yarp/http-client-config#httprequest>.
42+
43+
The following shows how to configure the outgoing proxy request to use HTTP/2:
4244

43-
This shows configuring the outgoing proxy request to use HTTP/2 over http.
4445
```json
4546
"cluster1": {
4647
"HttpRequest": {
Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,89 @@
11
---
22
uid: fundamentals/servers/yarp/header-guidelines
3-
title: YARP HTTP Headers
4-
description: YARP HTTP Headers
3+
title: YARP HTTP header guidelines
4+
description: Learn about YARP HTTP header guidelines.
55
author: samsp-msft
66
ms.author: samsp
77
ms.date: 2/6/2025
88
ms.topic: article
99
content_well_notification: AI-contribution
1010
ai-usage: ai-assisted
1111
---
12+
# YARP HTTP header guidelines
1213

13-
# YARP HTTP Headers
14-
15-
Headers are a very important part of processing HTTP requests and each have their own semantics and considerations. Most headers are proxied by default, though some used to control how the request is delivered are automatically adjusted or removed by the proxy. The connections between the client and the proxy and the proxy and destination are independent, and so headers that affect the connection and transport need to be filtered. Many headers contain information like domain names, paths, or other details that may be affected when a reverse proxy is included in the application architecture. Below is a collection of guidelines about how specific headers might be impacted and what to do about them.
14+
Headers are a very important part of processing HTTP requests and each have their own semantics and considerations. Most headers are proxied by default, though some used to control how the request is delivered are automatically adjusted or removed by the proxy. The connections between the client and the proxy and between the proxy and the destination are independent. Therefore, headers that affect the connection and transport must be filtered. Many headers contain information like domain names, paths, or other details that may be affected when a reverse proxy is included in the application architecture. The following is a collection of guidelines about how specific headers might be impacted and what to do about them.
1615

1716
## YARP header filtering
1817

1918
YARP automatically removes request and response headers that could impact its ability to forward a request correctly, or that may be used maliciously to bypass features of the proxy. A complete list can be found [here](https://github.com/microsoft/reverse-proxy/blob/main/src/ReverseProxy/Forwarder/RequestUtilities.cs#L71), with some highlights described below.
2019

21-
### Connection, KeepAlive, Close
20+
### `Connection`, `KeepAlive`, `Close`
2221

23-
These headers control how the TCP connection is managed and are removed to avoid impacting the connection on the other side of the proxy.
22+
These headers control how the TCP connection is managed and are removed to prevent impacting the connection on the other side of the proxy.
2423

25-
### Transfer-Encoding
24+
### `Transfer-Encoding`
2625

2726
This header describes the format of the request or response body on the wire, e.g. 'chunked', and is removed because the format can vary between the internal and external connection. The incoming and outgoing HTTP stacks will add transport headers as needed.
2827

29-
### TE
28+
### `TE`
3029

3130
Only the `TE: trailers` header value is allowed through the proxy since it's required for some gRPC implementations.
3231

33-
### Upgrade
32+
### `Upgrade`
3433

3534
This is used for protocols like WebSockets. It is removed by default and only added back for specifically supported protocols (WebSockets, SPDY).
3635

37-
### Proxy-*
36+
### `Proxy-*`
3837

3938
These are headers used with proxies and are not considered appropriate to forward.
4039

41-
### Alt-Svc
40+
### `Alt-Svc`
4241

4342
This response header is used with HTTP/3 upgrades and only applies to the immediate connection.
4443

4544
### Distributed tracing headers
4645

47-
These headers include TraceParent, Request-Id, TraceState, Baggage, Correlation-Context.
48-
They are automatically removed based on `DistributedContextPropagator.Fields` so that the forwarding HttpClient can replace them with updated values.
49-
You can opt out of modifying these headers by setting `SocketsHttpHandler.ActivityHeadersPropagator` to `null`:
50-
```C#
46+
These headers include `TraceParent`, `Request-Id`, `TraceState`, `Baggage`, and `Correlation-Context`.
47+
48+
They're automatically removed based on <xref:System.Diagnostics.DistributedContextPropagator.Fields%2A?displayProperty=nameWithType>, allowing the forwarding <xref:System.Net.Http.HttpClient> to replace them with updated values.
49+
50+
You can opt out of modifying these headers by setting <xref:System.Net.Http.SocketsHttpHandler.ActivityHeadersPropagator%2A?displayProperty=nameWithType> to `null`:
51+
52+
```csharp
5153
services.AddReverseProxy()
5254
.ConfigureHttpClient((_, handler) => handler.ActivityHeadersPropagator = null);
5355
```
5456

55-
### Strict-Transport-Security
57+
### `Strict-Transport-Security`
5658

5759
This header instructs clients to always use HTTPS, but there may be a conflict between values provided by the proxy and destination. To avoid confusion, the destination's value is not copied to the response if one was already added to the response by the proxy application.
5860

59-
## Other Header Guidelines
61+
## Other header guidelines
6062

61-
### Host
63+
### `Host`
6264

63-
The Host header indicates which site on the server the request is intended for. This header is removed by default since the host name used publicly by the proxy is likely to differ from the one used by the service behind the proxy. This is configurable using the [RequestHeaderOriginalHost](xref:fundamentals/servers/yarp/transforms#requestheaderoriginalhost) transform.
65+
The Host header indicates which site on the server the request is intended for. This header is removed by default since the host name used publicly by the proxy is likely to differ from the one used by the service behind the proxy. This can be configured using the [`RequestHeaderOriginalHost`](xref:fundamentals/servers/yarp/transforms#requestheaderoriginalhost) transform.
6466

65-
### X-Forwarded-*, Forwarded
67+
### `X-Forwarded-*`, `Forwarded`
6668

67-
Because a separate connection is used to communicate with the destination, these request headers can be used to forward information about the original connection like the IP, scheme, port, client certificate, etc.. X-Forwarded-For, X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Prefix are enabled by default. This information is subject to spoofing attacks so any existing headers on the request are removed and replaced by default. The destination app should be careful about how much trust it places in these values. See [transforms](xref:fundamentals/servers/yarp/transforms#defaults) for configuring these in the proxy. See the [ASP.NET docs](/aspnet/core/host-and-deploy/proxy-load-balancer) for configuring the destination app to read these headers.
69+
Because a separate connection is used to communicate with the destination, these request headers can be used to forward information about the original connection, such as the IP, scheme, port, and client certificate. `X-Forwarded-For`, `X-Forwarded-Proto`, `X-Forwarded-Host`, and `X-Forwarded-Prefix` are enabled by default. This information is subject to spoofing attacks so any existing headers on the request are removed and replaced by default. The destination app should be careful about how much trust it places in these values. See [transforms](xref:fundamentals/servers/yarp/transforms#defaults) for configuring these in the proxy. For guidance on configuring the destination app to read these headers, see <xref:host-and-deploy/proxy-load-balancer>.
6870

69-
### X-http-method-override, x-http-method, x-method-override
71+
### `X-http-method-override`, `x-http-method`, `x-method-override`
7072

71-
Some clients and servers limit which HTTP methods they allow (GET, POST, etc.). These request headers are sometimes used to work around those restrictions. These headers are proxied by default. If in the proxy you want to prevent these bypasses then use the [RequestHeaderRemove](xref:fundamentals/servers/yarp/transforms#requestheaderremove) transform.
73+
Some clients and servers limit which HTTP methods they allow (for example, GET). These request headers are sometimes used to work around those restrictions. These headers are proxied by default. If in the proxy you want to prevent these bypasses then use the [RequestHeaderRemove](xref:fundamentals/servers/yarp/transforms#requestheaderremove) transform.
7274

73-
### Set-Cookie
75+
### `Set-Cookie`
7476

75-
This response header may contain fields constraining the path, domain, scheme, etc. where the cookie should be used. Using a reverse proxy may change the effective domain, path, or scheme of a site from the public view. While it would be possible to [rewrite](https://github.com/microsoft/reverse-proxy/issues/1109) response cookies using custom transforms, it's recommended instead to use the Forwarded headers described above to flow the correct values to the destination app so it can generate the correct set-cookie headers.
77+
This response header may contain fields that constrain aspects of the URL, such as the scheme, domain, or path, where the cookie should be used. Using a reverse proxy may change the effective scheme, domain, or path of a site from the public view. While it would be possible to [rewrite response cookies using custom transforms](https://github.com/microsoft/reverse-proxy/issues/1109), we recommended instead to use the `Forwarded` headers described earlier to flow the correct values to the destination app so it can generate the correct `set-cookie` headers.
7678

77-
### Location
79+
### `Location`
7880

7981
This response header is used with redirects and may contain a scheme, domain, and path that differ from the public values due to the use of the proxy. While it would be possible to [rewrite](https://github.com/microsoft/reverse-proxy/discussions/466) the Location header using custom transforms, it's recommended instead to use the Forwarded headers described above to flow the correct values to the destination app so it can generate the correct Location headers.
8082

81-
### Server
83+
### `Server`
8284

83-
This response header indicates what server technology was used to generate the response (IIS, Kestrel, etc.). This header is proxied from the destination by default. Applications that want to remove it can use the [ResponseHeaderRemove](xref:fundamentals/servers/yarp/transforms#responseheaderremove) transform, in which case the proxy's default server header will be used. Suppressing the proxy default server header is server specific, such as for [Kestrel](/dotnet/api/microsoft.aspnetcore.server.kestrel.core.kestrelserveroptions.addserverheader#Microsoft_AspNetCore_Server_Kestrel_Core_KestrelServerOptions_AddServerHeader).
85+
This response header indicates what server technology was used to generate the response (for example, IIS, Kestrel). This header is proxied from the destination by default. Applications that want to remove it can use the [ResponseHeaderRemove](xref:fundamentals/servers/yarp/transforms#responseheaderremove) transform, in which case the proxy's default server header will be used. Suppressing the proxy default server header is server specific, such as for [Kestrel](/dotnet/api/microsoft.aspnetcore.server.kestrel.core.kestrelserveroptions.addserverheader#Microsoft_AspNetCore_Server_Kestrel_Core_KestrelServerOptions_AddServerHeader).
8486

85-
### X-Powered-By
87+
### `X-Powered-By`
8688

87-
This response header indicates what web framework was used to generate the response (ASP.NET, etc.). ASP.NET Core does not generate this header but IIS can. This header is proxied from the destination by default. Applications that want to remove it can use the [ResponseHeaderRemove](xref:fundamentals/servers/yarp/transforms#responseheaderremove) transform.
89+
This response header indicates what web framework was used to generate the response (for example, ASP.NET). ASP.NET Core does not generate this header but IIS can. This header is proxied from the destination by default. Applications that want to remove it can use the [ResponseHeaderRemove](xref:fundamentals/servers/yarp/transforms#responseheaderremove) transform.

0 commit comments

Comments
 (0)