HTTP upstream health-check directives
health_check directive (HTTP, NGINX Plus)
Commercial location directive for periodic probes of peers in shared upstream state. All options are optional; gRPC mode is incompatible with HTTP uri/match and has ordering restrictions. Verify licensed release.
Formal Syntax & Structure
nginx syntaxnginx
health_check [parameters];Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| interval | interval=duration | Probe cadence. |
| jitter | jitter=duration | Random delay range. |
| fails | fails=positive integer | Failures required to mark unhealthy. |
| passes | passes=positive integer | Successes required to recover. |
| uri | uri=path | HTTP probe target; incompatible with gRPC mode. |
| mandatory | literal mandatory | Start in checking state. |
| persistent | literal persistent | With mandatory, retain initial healthy state across reload where applicable. |
| match | match=name | Named HTTP response conditions; incompatible with gRPC mode. |
| port | port=number | Override probe port. |
| keepalive_time | keepalive_time=duration | Enable probe connection reuse. |
| type | type=grpc | Place after other non-gRPC options. |
| grpc_service | grpc_service=name | Optional after type=grpc. |
| grpc_status | grpc_status=code | Optional after type=grpc; intentionally review any nonzero healthy result. |
Working Example
Example Snippetnginx
health_check uri=/ready interval=5s fails=2 passes=2 mandatory;