Configure YARP for Blocking Traffic When Unhealthy #2709
-
I’m using YARP to manage reverse proxy traffic for my .NET services and have configured active health checks for my cluster (as shown in https://microsoft.github.io/reverse-proxy/articles/dests-health-checks.html). My goal is to ensure that if the health check endpoint (/healthz/ready) returns a failure status (e.g., HTTP 503), YARP completely blocks traffic to that endpoint and responds with HTTP 503 to clients attempting to access it. However, even when the health check marks a destination as unhealthy, clients can still access the endpoint, and traffic is not blocked as expected. Steps:
Result: I would like to achieve the following behavior:
Questions:
Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What YARP does when you run out of healthy destinations is up to the We currently default to "HealthCheck": {
"AvailableDestinationsPolicy": "HealthyAndUnknown",
"Active": {
// ...
}
} |
Beta Was this translation helpful? Give feedback.
What YARP does when you run out of healthy destinations is up to the
IAvailableDestinationsPolicy
.There are two such policies built-in:
HealthyAndUnknown
andHealthyOrPanic
.We currently default to
HealthyOrPanic
, which will "panic" and allow traffic to all destinations if you run out of healthy ones.If you switch to
HealthyAndUnknown
, you will see the behavior you wanted, where YARP will respond with a 503.