You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/servers/yarp/authn-authz.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,8 @@ Example:
51
51
[Authorization policies](/aspnet/core/security/authorization/policies) are an ASP.NET Core concept that the proxy utilizes. The proxy provides the above configuration to specify a policy per route and the rest is handled by existing ASP.NET Core authentication and authorization components.
52
52
53
53
Authorization policies can be configured in the application as follows:
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/servers/yarp/config-providers.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,13 +42,13 @@ For additional fields see [ClusterConfig](xref:Yarp.ReverseProxy.Configuration.C
42
42
43
43
The `InMemoryConfigProvider` implements `IProxyConfigProvider` and enables specifying routes and clusters directly in code by calling `LoadFromMemory`.
To update the config later, resolve the `InMemoryConfigProvider` from the services container and call `Update` with the new lists of routes and clusters.
@@ -87,13 +87,15 @@ Once the new configuration has been validated and applied, the proxy will regist
87
87
## Multiple Configuration Sources
88
88
As of 1.1, YARP supports loading the proxy configuration from multiple sources. Multiple `IProxyConfigProvider`'s can be registered as singleton services and all will be resolved and combined. The sources may be the same or different types such as IConfiguration or InMemory. Routes can reference clusters from other sources. Note merging partial config from different sources for a given route or cluster is not supported.
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/servers/yarp/cors.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Example:
51
51
[CORS policies](/aspnet/core/security/cors#cors-with-named-policy-and-middleware) are an ASP.NET Core concept that the proxy utilizes. The proxy provides the above configuration to specify a policy per route and the rest is handled by existing ASP.NET Core CORS Middleware.
52
52
53
53
CORS policies can be configured in the application as follows:
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/servers/yarp/dests-health-checks.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -280,6 +280,7 @@ Global parameters are set via the options mechanism using `TransportFailureRateH
280
280
*`DefaultFailureRateLimit` - default failure rate limit for a destination to be marked as unhealthy that is applied if it's not set on a cluster's metadata. The value is in range `(0,1)`. Default is `0.3` (30%).
281
281
282
282
Global policy options can be set in code as follows:
@@ -51,27 +51,27 @@ In the preceding commands, the `{REGISTRY_NAME}` placeholder is the name of the
51
51
The first step is to deploy the YARP ingress controller to the Kubernetes cluster. This can be done by navigating to [Kubernetes Ingress sample](https://github.com/dotnet/yarp/tree/release/latest/samples/KubernetesIngress.Sample)`\samples\KubernetesIngress.Sample\Ingress`
52
52
and running (after modifying `ingress-controller.yaml` with the same `REGISTRY_NAME` and `TAG`):
53
53
54
-
```
54
+
```bash
55
55
kubectl apply -f ingress-controller.yaml
56
56
```
57
57
58
58
To verify that the ingress controller has been deployed, run:
59
59
60
-
```
60
+
```bash
61
61
kubectl get pods -n yarp
62
62
```
63
63
64
64
You can then check logs from the ingress controller by running:
65
65
66
-
```
66
+
```bash
67
67
kubectl logs {POD NAME} -n yarp
68
68
```
69
69
70
70
All services, deployments, and pods for YARP are in the namespace `yarp`. Make sure to include `-n yarp` if you want to check on the status of yarp.
71
71
72
72
Next, build and deploy the ingress. In the root of the repository, run:
@@ -80,7 +80,7 @@ In the preceding commands, the `{REGISTRY_NAME}` placeholder is the name of the
80
80
81
81
Finally, we need to deploy the ingress itself to Kubernetes. Navigate to the `Ingress` directory and modify the `ingress.yaml` file for your registry and tag specified earlier and run:
82
82
83
-
```
83
+
```bash
84
84
kubectl apply -f .\ingress.yaml
85
85
```
86
86
@@ -90,28 +90,28 @@ At this point, your ingress and controller should be running.
90
90
91
91
To use the ingress, we now need to deploy an application to Kubernetes. Navigate to `samples\KuberenetesIngress.Sample\backend` and run:
92
92
93
-
```
93
+
```bash
94
94
docker build . -t {REGISTRY_NAME}/backend:{TAG}
95
95
docker push {REGISTRY_NAME}/backend:{TAG}
96
96
```
97
97
98
98
And deploying it to Kubernetes by running, after modifying `backend.yaml` with the same registry name (`{REGISTRY_NAME}`) and tag (`{TAG}`):
99
99
100
-
```
100
+
```bash
101
101
kubectl apply -f .\backend.yaml
102
102
```
103
103
104
104
## Creating the ingress definition
105
105
106
106
Finally, once we have deployed the backend application, we need to route traffic to the backend. To do this, run in the `backend` directory:
107
107
108
-
```
108
+
```bash
109
109
kubectl apply -f .\ingress-sample.yaml
110
110
```
111
111
112
112
And then execute the following command to get the external IP of the ingress, the name of the related service being `yarp-proxy`:
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/servers/yarp/middleware.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ Middleware added to your application pipeline will see the request in different
36
36
37
37
[ReverseProxyIEndpointRouteBuilderExtensions](xref:Microsoft.AspNetCore.Builder.ReverseProxyIEndpointRouteBuilderExtensions) provides an overload of `MapReverseProxy` that lets you build a middleware pipeline that will run only for requests matched to proxy configured routes.
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/servers/yarp/rate-limiting.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ The reverse proxy can be used to rate-limit requests before they are proxied to
22
22
No rate limiting is performed on requests unless enabled in the route or application configuration. However, the Rate Limiting middleware (`app.UseRateLimiter()`) can apply a default limiter applied to all routes, and this doesn't require any opt-in from the config.
[RateLimiter policies](/aspnet/core/performance/rate-limit) are an ASP.NET Core concept that the proxy utilizes. The proxy provides the above configuration to specify a policy per route and the rest is handled by existing ASP.NET Core rate limiting middleware.
59
60
60
61
RateLimiter policies can be configured in services as follows:
Copy file name to clipboardExpand all lines: aspnetcore/fundamentals/servers/yarp/session-affinity.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ Session affinity is a mechanism to bind (affinitize) a causally related request
20
20
Session affinity services are registered in the DI container automatically by `AddReverseProxy()`. The middleware `UseSessionAffinity()` is included by default in the parameterless MapReverseProxy method. If you are customizing the proxy pipeline, place the first middleware **before** adding `UseLoadBalancing()`.
0 commit comments