Skip to content

Commit c954af6

Browse files
Light Freshness Edit: ASP.NET - Startup, gRPC, YARP, SPA (#37053)
* refresh content + include * edit external refs * Apply suggestions from code review Co-authored-by: Wade Pickett <wpickett@microsoft.com> * Fix character escaping in IStartupFilter documentation Updated the text in the IStartupFilter section to escape special characters for proper rendering. * Update aspnetcore/grpc/index.md Co-authored-by: Wade Pickett <wpickett@microsoft.com> --------- Co-authored-by: Wade Pickett <wpickett@microsoft.com>
1 parent 7ba1798 commit c954af6

10 files changed

Lines changed: 212 additions & 147 deletions

File tree

aspnetcore/client-side/spa/intro.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
2-
title: Overview of Single Page Apps (SPAs) in ASP.NET Core
2+
title: Overview of Single Page Apps (SPAs) - ASP.NET Core
33
author: wadepickett
44
ms.author: wpickett
55
monikerRange: '>= aspnetcore-6.0'
6-
description: Overview of Single Page Apps (SPAs) in ASP.NET Core
7-
ms.date: 09/12/2023
6+
description: Learn how to get started with Single Page Apps (SPAs) in ASP.NET Core and find links to tutorials for detailed procedures.
7+
ms.date: 04/24/2026
88
uid: spa/intro
9+
10+
# customer intent: As an ASP.NET developer, I want to get an overview of SPAs in ASP.NET Core, so I can determine the appropriate tutorial to create apps.
911
---
1012
# Overview of Single Page Apps (SPAs) in ASP.NET Core
1113

@@ -27,6 +29,10 @@ For more information, see [JavaScript and TypeScript in Visual Studio](/visualst
2729

2830
[!INCLUDE [spa-templates-new-vs-old](../../includes/spa-templates-new-vs-old.md)]
2931

32+
## Related content
33+
34+
- [Developing Single Page Apps](/aspnet/core/client-side/spa/intro?view=aspnetcore-7.0&preserve-view=true#developing-single-page-apps)
35+
3036
::: moniker-end
3137

3238
[!INCLUDE[](~/client-side/spa/includes/intro6-7.md)]

aspnetcore/client-side/spa/react.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ description: Learn how to get started with the ASP.NET Core Single Page Applicat
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: wpickett
77
ms.custom: mvc
8-
ms.date: 09/08/2023
8+
ms.date: 04/24/2026
99
uid: spa/react
10+
11+
# customer intent: As an ASP.NET developer, I want to get started with the SPA project template for React and CRA, so I can use React and create apps.
1012
---
1113
# Use React with ASP.NET Core
1214

@@ -24,6 +26,10 @@ For more information, see [JavaScript and TypeScript in Visual Studio](/visualst
2426

2527
[!INCLUDE [spa-templates-new-vs-old](../../includes/spa-templates-new-vs-old.md)]
2628

29+
## Related content
30+
31+
- [Overview of Single Page Apps (SPAs) in ASP.NET Core](./intro.md)
32+
2733
:::moniker-end
2834

2935
[!INCLUDE[](~/client-side/spa/includes/react3-7.md)]

aspnetcore/fundamentals/servers/yarp/config-files.md

Lines changed: 71 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
---
22
uid: fundamentals/servers/yarp/config-files
33
title: YARP Configuration Files
4-
description: YARP Configuration Files
4+
description: Explore how to work with YARP configuration files, examine the file structure and properties, define routes, clusters, and sources, and load proxy configuration.
55
author: wadepickett
66
ms.author: wpickett
7-
ms.date: 2/6/2025
7+
ms.date: 04/24/2026
88
ms.topic: concept-article
99
content_well_notification: AI-contribution
1010
ai-usage: ai-assisted
11-
---
1211

12+
# customer intent: As an ASP.NET developer, I want to get started with the YARP library, so I can learn how customize the modules.
13+
---
1314
# YARP Configuration Files
1415

15-
## Introduction
16-
The reverse proxy can load configuration for routes and clusters from files using the IConfiguration abstraction from Microsoft.Extensions. The examples given here use JSON, but any IConfiguration source should work. The configuration will also be updated without restarting the proxy if the source file changes.
16+
The reverse proxy can load configuration for routes and clusters from files by using the [IConfiguration](/dotnet/api/microsoft.extensions.configuration.iconfiguration) abstraction from Microsoft.Extensions.
17+
18+
This article provides example proxy configuration for YARP. Although the configuration example uses JSON, any `IConfiguration` source should work. Also, the configuration updates without restarting the proxy when the source file changes.
19+
20+
## Load the proxy configuration
21+
22+
To load the proxy configuration from the `IConfiguration` instance, add the following code in the _Program.cs_ file:
1723

18-
## Loading Configuration
19-
To load the proxy configuration from IConfiguration add the following code in Program.cs:
2024
```csharp
2125
using Microsoft.AspNetCore.Builder;
2226
using Microsoft.Extensions.DependencyInjection;
@@ -35,33 +39,41 @@ app.MapReverseProxy();
3539

3640
app.Run();
3741
```
38-
**Note**: For details about middleware ordering see [here](/aspnet/core/fundamentals/middleware/#middleware-order).
3942

40-
Configuration can be modified during the load sequence using [Configuration Filters](xref:fundamentals/servers/yarp/config-filters).
43+
> [!NOTE]
44+
> For details about middleware ordering, see [ASP.NET Core Middleware > Middleware order](/aspnet/core/fundamentals/middleware/#middleware-order).
45+
46+
Configuration can be modified during the load sequence by using [YARP configuration filters](xref:fundamentals/servers/yarp/config-filters).
47+
48+
## Load from multiple configuration sources
49+
50+
Starting in version 1.1, YARP supports loading the proxy configuration from multiple sources. You can call the `LoadFromConfig` method multiple times and reference different `IConfiguration` sections. You can also combine the call with a different config source, such as InMemory. Routes can reference clusters from other sources.
4151

42-
## Multiple Configuration Sources
43-
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.
52+
> [!NOTE]
53+
> Merging partial config from different sources for a given route or cluster isn't supported.
4454
4555
```csharp
4656
services.AddReverseProxy()
4757
.LoadFromConfig(Configuration.GetSection("ReverseProxy1"))
4858
.LoadFromConfig(Configuration.GetSection("ReverseProxy2"));
4959
```
50-
or
60+
Another example:
61+
5162
```csharp
5263

5364
services.AddReverseProxy()
5465
.LoadFromMemory(routes, clusters)
5566
.LoadFromConfig(Configuration.GetSection("ReverseProxy"));
5667
```
5768

58-
## Configuration contract
59-
File-based configuration is dynamically mapped to the types in [Yarp.ReverseProxy.Configuration](xref:Yarp.ReverseProxy.Configuration) namespace by an [IProxyConfigProvider](xref:Yarp.ReverseProxy.Configuration.IProxyConfigProvider) implementation converts at application start and each time the configuration changes.
69+
## Review the configuration contract
70+
71+
File-based configuration is dynamically mapped to the types in the [Yarp.ReverseProxy.Configuration](xref:Yarp.ReverseProxy.Configuration) namespace by an [IProxyConfigProvider](xref:Yarp.ReverseProxy.Configuration.IProxyConfigProvider) implementation. The contract converts at application start and each time the configuration changes.
6072

61-
## Configuration Structure
62-
The configuration consists of a named section that you specified above via `Configuration.GetSection("ReverseProxy")`, and contains subsections for routes and clusters.
73+
## Examine the configuration structure
74+
75+
The configuration consists of a named section and subsections for routes and clusters. In the previous example, the named section is `Configuration.GetSection("ReverseProxy")`.
6376

64-
Example:
6577
```json
6678
{
6779
"ReverseProxy": {
@@ -87,29 +99,35 @@ Example:
8799
}
88100
```
89101

90-
### Routes
102+
### Define configuration routes
103+
104+
The `Routes` section is an unordered collection of route matches and their associated configuration.
91105

92-
The routes section is an unordered collection of route matches and their associated configuration. A route requires at least the following fields:
106+
Each route requires at least the following fields:
93107

94-
* RouteId - a unique name
95-
* ClusterId - refers to the name of an entry in the clusters section.
96-
* 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).
108+
* `RouteId`: A unique name for the route.
109+
* `ClusterId`: The name of an entry in the `Clusters` section.
110+
* `Match`: Either a `Hosts` array or a `Path` pattern string. You can define the path by using [Routing in ASP.NET Core > Route templates](/aspnet/core/fundamentals/routing#route-templates).
97111

98-
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.
112+
Route matching is based on the most specific routes having highest precedence, as described in [URL matching](/aspnet/core/fundamentals/routing#url-matching). Explicit ordering can be achieved by using the `order` field, where lower values take higher priority.
99113

100-
[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).
114+
[YARP headers](xref:fundamentals/servers/yarp/header-routing), [authentication and authorization](xref:fundamentals/servers/yarp/authn-authz), [cross-origin requests (CORS)](xref:fundamentals/servers/yarp/cors), and other route-based policies can be configured on each route entry. For other fields, see the [RouteConfig](xref:Yarp.ReverseProxy.Configuration.RouteConfig) reference.
101115

102-
The proxy will apply the given matching criteria and policies, and then pass off the request to the specified cluster.
116+
The proxy applies the given matching criteria and policies, and passes off the request to the specified cluster.
103117

104-
### Clusters
105-
The clusters section is an unordered collection of named clusters. A cluster primarily contains a collection of named destinations and their addresses, any of which is considered capable of handling requests for a given route. The proxy will process the request according to the route and cluster configuration in order to select a destination.
118+
### Define configuration clusters
106119

107-
For additional fields see [ClusterConfig](xref:Yarp.ReverseProxy.Configuration.ClusterConfig).
120+
The `Clusters` section is an unordered collection of named clusters. A cluster primarily contains a collection of named destinations and their addresses, any of which is considered capable of handling requests for a given route. The proxy processes the request according to the route and cluster configuration to select a destination.
121+
122+
For other fields, see the [ClusterConfig](xref:Yarp.ReverseProxy.Configuration.ClusterConfig) reference.
123+
124+
## Review all config properties
125+
126+
The following JSON example shows all properties available for the YARP proxy configuration.
108127

109-
## All config properties
110128
```json
111129
{
112-
// Base URLs the server listens on, must be configured independently of the routes below
130+
// Base URLs the server listens on, must be configured independently of the routes defined below
113131
"Urls": "http://localhost:5000;https://localhost:5001",
114132
"Logging": {
115133
"LogLevel": {
@@ -121,39 +139,39 @@ For additional fields see [ClusterConfig](xref:Yarp.ReverseProxy.Configuration.C
121139
}
122140
},
123141
"ReverseProxy": {
124-
// Routes tell the proxy which requests to forward
142+
// Routes inform the proxy which requests to forward
125143
"Routes": {
126144
"minimumroute" : {
127-
// Matches anything and routes it to www.example.com
145+
// Matches anything and routes to www.example.com
128146
"ClusterId": "minimumcluster",
129147
"Match": {
130148
"Path": "{**catch-all}"
131149
}
132150
},
133151
"allrouteprops" : {
134-
// matches /something/* and routes to "allclusterprops"
135-
"ClusterId": "allclusterprops", // Name of one of the clusters
152+
// Matches /something/* and routes to "allclusterprops"
153+
"ClusterId": "allclusterprops", // Name of a cluster
136154
"Order" : 100, // Lower numbers have higher precedence
137155
"MaxRequestBodySize" : 1000000, // In bytes. An optional override of the server's limit (30MB default). Set to -1 to disable.
138156
"AuthorizationPolicy" : "Anonymous", // Name of the policy or "Default", "Anonymous"
139157
"CorsPolicy" : "Default", // Name of the CorsPolicy to apply to this route or "Default", "Disable"
140158
"Match": {
141-
"Path": "/something/{**remainder}", // The path to match using ASP.NET syntax.
142-
"Hosts" : [ "www.aaaaa.com", "www.bbbbb.com"], // The host names to match, unspecified is any
143-
"Methods" : [ "GET", "PUT" ], // The HTTP methods that match, uspecified is all
144-
"Headers": [ // The headers to match, unspecified is any
159+
"Path": "/something/{**remainder}", // Path to match by using ASP.NET syntax
160+
"Hosts" : [ "www.aaaaa.com", "www.bbbbb.com"], // Host names to match, unspecified is any
161+
"Methods" : [ "GET", "PUT" ], // HTTP methods that match, unspecified is all
162+
"Headers": [ // Headers to match, unspecified is any
145163
{
146164
"Name": "MyCustomHeader", // Name of the header
147-
"Values": [ "value1", "value2", "another value" ], // Matches are against any of these values
148-
"Mode": "ExactHeader", // or "HeaderPrefix", "Exists" , "Contains", "NotContains", "NotExists"
165+
"Values": [ "value1", "value2", "another value" ], // Match any of these values
166+
"Mode": "ExactHeader", // Or, match "HeaderPrefix", "Exists" , "Contains", "NotContains", "NotExists"
149167
"IsCaseSensitive": true
150168
}
151169
],
152-
"QueryParameters": [ // The query parameters to match, unspecified is any
170+
"QueryParameters": [ // Query parameters to match, unspecified is any
153171
{
154172
"Name": "MyQueryParameter", // Name of the query parameter
155-
"Values": [ "value1", "value2", "another value" ], // Matches are against any of these values
156-
"Mode": "Exact", // or "Prefix", "Exists" , "Contains", "NotContains"
173+
"Values": [ "value1", "value2", "another value" ], // Match any of these values
174+
"Mode": "Exact", // Or, match "Prefix", "Exists" , "Contains", "NotContains"
157175
"IsCaseSensitive": true
158176
}
159177
]
@@ -185,20 +203,20 @@ For additional fields see [ClusterConfig](xref:Yarp.ReverseProxy.Configuration.C
185203
},
186204
"another_destination": {
187205
"Address": "https://10.20.30.40",
188-
"Health" : "https://10.20.30.40:12345/test" // override for active health checks
206+
"Health" : "https://10.20.30.40:12345/test" // Override for active health checks
189207
}
190208
},
191209
"LoadBalancingPolicy" : "PowerOfTwoChoices", // Alternatively "FirstAlphabetical", "Random", "RoundRobin", "LeastRequests"
192210
"SessionAffinity": {
193-
"Enabled": true, // Defaults to 'false'
211+
"Enabled": true, // Default is 'false'
194212
"Policy": "Cookie", // Default, alternatively "CustomHeader"
195-
"FailurePolicy": "Redistribute", // default, Alternatively "Return503Error"
213+
"FailurePolicy": "Redistribute", // Default, alternatively "Return503Error"
196214
"Settings" : {
197-
"CustomHeaderName": "MySessionHeaderName" // Defaults to 'X-Yarp-Proxy-Affinity`
215+
"CustomHeaderName": "MySessionHeaderName" // Default is 'X-Yarp-Proxy-Affinity`
198216
}
199217
},
200218
"HealthCheck": {
201-
"Active": { // Makes API calls to validate the health.
219+
"Active": { // Makes API calls to validate the health
202220
"Enabled": "true",
203221
"Interval": "00:00:10",
204222
"Timeout": "00:00:10",
@@ -207,7 +225,7 @@ For additional fields see [ClusterConfig](xref:Yarp.ReverseProxy.Configuration.C
207225
"Query": "?foo=bar"
208226
},
209227
"Passive": { // Disables destinations based on HTTP response codes
210-
"Enabled": true, // Defaults to false
228+
"Enabled": true, // Default is false
211229
"Policy" : "TransportFailureRateHealthPolicy", // Required
212230
"ReactivationPeriod" : "00:00:10" // 10s
213231
}
@@ -236,4 +254,7 @@ For additional fields see [ClusterConfig](xref:Yarp.ReverseProxy.Configuration.C
236254
}
237255
```
238256

239-
For more information see [logging configuration](diagnosing-yarp-issues.md#logging) and [HTTP client configuration](xref:fundamentals/servers/yarp/http-client-config).
257+
## Related content
258+
259+
- [Logging configuration](diagnosing-yarp-issues.md#logging)
260+
- [HTTP client configuration](xref:fundamentals/servers/yarp/http-client-config)

0 commit comments

Comments
 (0)