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

NameTypeDescription
intervalinterval=durationProbe cadence.
jitterjitter=durationRandom delay range.
failsfails=positive integerFailures required to mark unhealthy.
passespasses=positive integerSuccesses required to recover.
uriuri=pathHTTP probe target; incompatible with gRPC mode.
mandatoryliteral mandatoryStart in checking state.
persistentliteral persistentWith mandatory, retain initial healthy state across reload where applicable.
matchmatch=nameNamed HTTP response conditions; incompatible with gRPC mode.
portport=numberOverride probe port.
keepalive_timekeepalive_time=durationEnable probe connection reuse.
typetype=grpcPlace after other non-gRPC options.
grpc_servicegrpc_service=nameOptional after type=grpc.
grpc_statusgrpc_status=codeOptional after type=grpc; intentionally review any nonzero healthy result.

Working Example

Example Snippetnginx
health_check uri=/ready interval=5s fails=2 passes=2 mandatory;
Nginx Reference