API Gateway Health Checks: Active and Passive Practices
March 20, 2025
API gateway health checks determine which upstream nodes are eligible to receive gateway traffic. Active checks send dedicated probes; passive checks evaluate outcomes from real proxied requests. A useful strategy defines what counts as success or failure, how many observations change node state, and how an excluded node can recover.
This page focuses on gateway-to-upstream behavior. For liveness, readiness, dependency, and synthetic checks implemented by an application or orchestrator, use the companion guide to API health check methods.
Key Takeaways
- Combine active and passive checks when you need both proactive detection and recovery evidence.
- Tune intervals, timeouts, status codes, and consecutive-success or failure thresholds from service behavior.
- Keep probe endpoints bounded and prevent detailed operational data from leaking through public responses.
- Observe node-state changes alongside traffic, errors, latency, deployments, and dependency incidents.
- Test detection, traffic removal, recovery, and the no-healthy-node case before relying on failover.
Active vs. Passive Gateway Health Checks
| Check type | Signal | Strength | Limitation |
|---|---|---|---|
| Active | Gateway sends HTTP, HTTPS, TCP, or product-supported probes | Can detect failure without waiting for user traffic and can test recovery | Adds probe traffic and depends on a representative endpoint |
| Passive | Gateway evaluates timeouts, connection failures, or response status from proxied traffic | Uses real request outcomes and adds no separate probe | Cannot detect an idle failure; recovery behavior varies by gateway |
| Combined | Passive failures remove a node and active successes test it again | Covers real traffic and recovery | Requires thresholds that avoid flapping and probe storms |
Apache APISIX supports active and passive upstream health checks. In APISIX, a node excluded by passive checks cannot receive the successful traffic needed to mark it healthy again through passive observation alone, so active checks are normally required for recovery.
The Importance of Health Checks in API Gateways
Ensuring System Reliability
Health checks help the gateway avoid nodes that meet the configured unhealthy criteria. They reduce exposure to some node failures but do not guarantee uninterrupted service: the upstream may have no healthy nodes, the check may not represent the user path, or a dependency may fail after a node is selected. Combining active and passive health checks gives the gateway more than one source of evidence.
Health-check state should be correlated with gateway metrics, logs, and traces. A binary node status cannot explain whether the cause is the application, network, dependency, certificate, probe path, or threshold configuration.
Tip: Health checks, retries, circuit breaking, and load balancing solve different failure problems. Configure their timeout and retry budgets together so one failing dependency does not amplify traffic.
Detecting and Addressing Failures Early
Gateway health checks provide evidence about whether an upstream node satisfies the configured success criteria. They can detect connection errors, timeouts, or configured response codes; documentation drift, application correctness, and broader performance analysis require separate tests and observability.
Gateway health checks can mark nodes unhealthy and remove them from normal load-balancer selection according to product behavior. Test what the gateway does when one node fails, when it recovers, and when no healthy node remains; failover is not guaranteed merely because a check is configured.
Note: Following best practices for health checks maximizes their value, helping you maintain a stable and reliable API gateway environment.
Defining Effective Health Check Criteria
Setting Clear Metrics for Success
Define the exact observations that change upstream eligibility: probe path and protocol, timeout, accepted and failed status codes, and consecutive success or failure counts. Traffic metrics such as latency and error rate help operators evaluate the result, but they are not automatically health-check inputs unless the gateway explicitly supports and configures them as such.
Define thresholds from the upstream's observed latency and the recovery objective. A timeout that is too short ejects healthy but busy nodes; one that is too long delays failover. Use consecutive observations and separate alert thresholds from node-ejection criteria when their operational consequences differ.
Tip: Use historical data to establish realistic benchmarks for your metrics. This ensures your health checks align with actual system performance.

Aligning Criteria with Business and Technical Goals
Translate recovery objectives into a detection and recovery budget for upstream nodes. For a latency-sensitive API, that may require shorter bounded probes, but the timeout must still account for normal upstream behavior and network variance.
Define criteria with the service owner and SRE team. A gateway probe should test whether the upstream node can accept the relevant traffic. Monitor third-party dependencies separately unless their failure truly means the node must leave rotation.
Note: Regularly review your criteria to ensure they adapt to evolving business needs and technical advancements.
Designing Lightweight Health Check Endpoints
Minimizing Resource Usage
Lightweight health check endpoints are essential for optimizing the performance of your API gateway. These endpoints should consume minimal system resources while providing accurate insights into the health of your services. Overly complex health checks can strain your infrastructure, especially during high-traffic periods. By designing endpoints that perform only essential checks, you reduce the risk of unnecessary resource consumption.
Focus on a bounded endpoint that represents the upstream's ability to accept the traffic the gateway will send. A TCP connection proves less than an HTTP request, while an expensive end-to-end transaction can overload the service. Choose the cheapest signal that is sufficient for the routing decision.
Tip: Monitor optional dependencies separately rather than making every routing probe wait for them.
Reducing Latency Impact
Health check endpoints should operate with minimal latency to avoid impacting the overall performance of your API gateway. High-latency health checks can delay critical decisions, such as rerouting traffic or marking nodes as unhealthy. To achieve low latency, ensure that your health checks execute quickly and return concise responses.
Limit each gateway probe to the cheapest operation that still represents upstream eligibility. Do not cache a result used for routing eligibility: stale success delays failure detection, while stale failure delays recovery. If operators need slower diagnostic data, collect it through a separate monitoring path with an explicit freshness window.
Note: Regularly monitor the performance of your health check endpoints to identify and address any latency issues promptly.
Keeping Gateway Health Checks at the Upstream Boundary
Checking Upstream Nodes
From the gateway's perspective, an upstream is the backend node selected to receive a proxied request. A health check should answer whether that node is eligible for the configured traffic. Client health, database health, and the state of every transitive dependency are separate concerns unless the upstream intentionally incorporates a required dependency into a bounded readiness endpoint.
Use active probes for a representative path when failure must be detected without user traffic, and passive checks for configured outcomes from real proxied requests. Correlate node state with tracing and application metrics during diagnosis, but do not make the gateway probe recursively test an entire dependency graph.
Tip: Regularly test the connectivity between your API gateway and its dependencies to detect issues before they affect users.
Handling Transitive and Third-Party Dependencies
Monitor third-party services with a bounded synthetic or dependency check owned by the application team. Include that state in upstream readiness only when the service truly cannot handle any relevant request without the dependency; otherwise a third-party incident can remove every otherwise usable node.
Fallback behavior belongs to the application or a deliberately designed resilience layer. A cached or default response is safe only when freshness, correctness, and user impact are understood. The gateway health check should not claim a service is healthy merely because one optional third-party dependency is unavailable.
Note: Establish clear SLAs (Service Level Agreements) with third-party providers to set expectations for performance and availability.
Automating API Gateway Health Checks
Leveraging CI/CD Pipelines
CI/CD can validate health-check configuration and run post-deployment requests, but runtime active and passive checks continue independently of the pipeline. Test configuration syntax, staged rollout behavior, node removal, and recovery before promoting a change.
CI/CD should test the health-check definition, deployment wiring, and expected node transitions in a controlled environment. Documentation checks, performance tests, and application error-path tests remain separate release controls.
Tip: Use pipeline tools such as Jenkins, GitLab CI, or GitHub Actions for configuration and post-deployment verification; let the gateway run its configured active and passive checks at runtime.
Using Infrastructure-as-Code (IaC) for Consistency
Infrastructure-as-Code (IaC) simplifies the process of implementing consistent health checks across your API gateway. By defining your infrastructure in code, you can standardize health check configurations and ensure they align with your system's architecture. This approach eliminates discrepancies caused by manual setup and reduces the likelihood of configuration errors.
IaC tools like Terraform or AWS CloudFormation allow you to version control your health check configurations. This ensures that any changes are tracked and can be rolled back if necessary. For instance, you can define health check endpoints, thresholds, and dependencies in your IaC templates. These templates can then be reused across multiple environments, maintaining uniformity and reducing setup time.
Note: Regularly review and update your IaC templates to adapt to evolving system requirements and best practices.
Implementing Granular Health Checks
Correlating Node State with Gateway Telemetry
Upstream health state is one operational signal. Correlate it with gateway traffic, errors, latency, saturation, configuration changes, and deployment events to diagnose why a node changed state and what users experienced. This monitoring does not change node eligibility unless it is explicitly part of the configured health-check mechanism.
The table below separates the routing decision from supporting diagnostic signals:
| Metric | Diagnostic value |
|---|---|
| Eligible upstream nodes | Shows how much routing capacity remains after health decisions |
| Probe latency and failures | Reveals slow or failing health endpoints and networks |
| Gateway error and latency distribution | Connects node state to user-facing traffic outcomes |
| CPU, memory, and connection use | Identifies resource saturation in the gateway or upstream |
| Throughput | Provides the load context for every other signal |
These metrics can reveal anomalies in gateway components or dependencies. For example, a spike in authentication errors may indicate a configuration or identity-provider issue. Use that evidence to diagnose impact; no single metric or prompt response guarantees uninterrupted service.
Tip: Use distributed tracing tools to visualize the performance of individual components and streamline troubleshooting efforts.

Avoiding Overgeneralized Health Statuses
A single service-level "healthy" or "unhealthy" label can hide which upstream nodes remain eligible. Keep the gateway's routing signal simple, while a restricted operator view records per-node state and the reason for the latest transition.
Keep node eligibility separate from restricted diagnostic detail. Operators may need node-level status to troubleshoot, but detailed responses should not be exposed publicly. For example, an internal diagnostic view might show:
{ "catalog-a": "healthy", "catalog-b": "unhealthy", "eligible_nodes": 1 }
This level of detail helps you prioritize fixes and allocate resources effectively. It also improves communication with stakeholders by providing a clear picture of system health.
Note: Regularly review your health check logic to ensure it aligns with the evolving architecture of your API gateway.
Setting Up Alerts for Health Check Failures
Using Real-Time Monitoring Tools
Monitoring systems can alert on upstream state changes and loss of eligible capacity, then correlate those events with gateway errors, latency, traffic, and saturation. They improve detection evidence but do not predict every failure. A latency increase or error spike should be evaluated against the service objective and current traffic rather than treated as a universal incident threshold.
Configure alerts from service objectives and observed baselines rather than universal latency or error thresholds. Alert on sustained state changes, loss of healthy capacity, probe failures, and disagreement between health-check state and user-facing errors. Monitoring systems such as Prometheus or a managed observability platform can record the evidence; the alert still needs an owner and runbook.
Tip: Direct alerts to the appropriate teams with relevant context to streamline the troubleshooting process and reduce resolution times.
Defining Escalation Policies
Alerts are only effective when paired with well-defined escalation policies. These policies outline the steps to follow when a health check failure occurs, ensuring a structured response. Start by categorizing alerts based on severity. For example, classify minor issues like increased latency as low priority, while critical failures such as complete service outages should receive the highest priority.
Once alerts are categorized, route them to the team that owns the gateway or upstream and attach the affected nodes, recent configuration changes, traffic impact, and runbook. Escalation should follow the incident policy and user impact, not an assumption that every unresolved alert must reach management.
Note: Regularly review and update your escalation policies to reflect changes in your team structure or system architecture.
Testing Health Check Scenarios Regularly
Simulating Failure Scenarios
Controlled failure tests show whether gateway health checks make the expected node-selection decisions. Run them in an approved environment with abort conditions, because intentionally failing nodes can affect capacity and user traffic.
Test refused connections, timeouts, configured unhealthy status codes, intermittent failure, slow probes, node recovery, and loss of all nodes. Load testing, application business logic, invalid inputs, and fallback correctness require separate test plans even when their results are correlated with gateway behavior.
Tip: Rehearse concrete failures first: timeout, refused connection, unhealthy status code, slow recovery, flapping, and loss of every node.
Validating Recovery Mechanisms
Testing recovery shows whether an excluded node returns to eligibility under the configured mechanism and thresholds. It does not prove every failure will recover quickly. Record the following evidence:
| Recovery evidence | What to verify |
|---|---|
| Node state timeline | The expected failures remove the node only after the configured threshold |
| Routed requests | New requests stop reaching an excluded node according to gateway behavior |
| Active recovery | Successful probes restore an eligible node after the success threshold |
| Capacity and errors | Remaining nodes can handle traffic without a retry or overload cascade |
Alert when the resulting loss of capacity or traffic impact breaches an agreed threshold. Route notifications through the organization's incident system with deduplication, ownership, and a runbook rather than sending every probe failure as an immediate page.
Implementing robust error handling is equally important. Log errors gracefully and use monitoring tools to gain insights into failures. This approach not only validates your recovery mechanisms but also strengthens your overall API health strategy.
Note: Regularly test and refine your recovery processes to adapt to evolving system requirements and ensure long-term reliability.
Securing API Gateway Health Check Endpoints
Restricting Access to Authorized Users
Minimize what a gateway health-check endpoint reveals and limit its network exposure. If the gateway supports sending the required probe headers, a protected endpoint can be appropriate; otherwise use a dedicated minimal path reachable only from the health-checking network. Do not put reusable credentials or sensitive diagnostics in the response.
Review network policy, probe credentials, and response content when the gateway or upstream changes. If operators need detailed diagnostics, protect that separate interface with access controls appropriate to the environment; keep the machine-consumed routing endpoint minimal.
Tip: Use monitoring tools to track access attempts and detect suspicious activity in real-time.

Preventing Exposure of Sensitive Information
Health check endpoints can reveal service state and topology. Use TLS when probe traffic crosses a network where confidentiality or integrity is required, and authenticate the upstream identity when supported. TLS protects traffic in transit but does not prevent an over-detailed response from reaching an authorized yet inappropriate consumer.
Authentication and authorization mechanisms also play a vital role in safeguarding sensitive information. By requiring valid credentials, you can prevent unauthorized users from accessing your health check endpoints. Align these practices with your application's overall security posture to maintain consistency across your system.
Additionally, avoid including sensitive details in health check responses. For instance, instead of returning detailed error messages, provide generic status codes that reveal minimal information. Regularly review and test your security configurations to adapt to evolving threats and maintain a strong defense.
Note: Protecting your health check endpoints not only enhances security but also reinforces the reliability of your API gateway.
Continuously Optimizing Health Check Strategies
Reviewing and Updating Configurations
Review health-check configuration when upstream behavior, capacity, topology, or recovery objectives change. An outdated path or threshold can cause slow detection, false ejection, or failed recovery; a review reduces that risk but cannot prevent every disruption.
When a required upstream behavior changes, decide whether the probe path and success criteria still represent eligibility. Do not automatically add every new dependency or feature to the gateway probe.
Validate updates by measuring removal time, recovery time, false state changes, remaining capacity, and user-facing errors during controlled tests and staged rollout.
Tip: Automate configuration reviews using tools like Infrastructure-as-Code to maintain consistency across environments.
Incorporating Feedback from Incident Postmortems
Incident postmortems offer valuable insights into the strengths and weaknesses of your health check strategies. After resolving an issue, analyze the root cause and evaluate how your health checks performed during the incident. This process helps you identify gaps in your monitoring system and refine your approach to prevent similar problems in the future.
If a postmortem finds that a dependency failure was invisible, first decide which system should own that signal. Change gateway readiness only when the dependency determines whether the upstream can serve the routed traffic; otherwise add application metrics, a dependency monitor, or a synthetic check.
Compare the incident timeline with probe outcomes, node-state changes, traffic, and recovery. Use that evidence to adjust timeouts or consecutive thresholds without assuming a more sensitive check is always safer.
Note: Treat postmortems as learning opportunities to enhance your health check configurations and improve system reliability.
Implementing Best Practices for API Gateway Health Checks
A disciplined health-check strategy improves the gateway's evidence for upstream selection. Start with a bounded endpoint and explicit thresholds, then add active/passive combination, observability, and failure testing as the service requires.
Active and passive checks provide different evidence. Combining them can improve detection and recovery, but it also introduces probe load and threshold interactions that must be tested.
| Outcome | Boundary |
|---|---|
| Real-traffic evidence | Passive checks see only requests the node receives |
| Failure detection without user traffic | Active checks add dedicated probe traffic |
| Recovery testing | Active successes can restore excluded nodes when supported and configured |
| More stable decisions | Consecutive thresholds help, but poor values can still cause flapping or slow failover |
Adopt the combination that matches the upstream and verify it under normal traffic, overload, partial failure, total failure, and recovery.
FAQ
What is the primary purpose of API Gateway health checks?
API gateway health checks determine which upstream nodes are eligible for traffic from the gateway. They can reduce exposure to detected node failures, but they do not monitor every dependency, prevent all downtime, or guarantee an uninterrupted user experience.
How often should you run health checks?
Choose the interval from the required detection time, timeout, probe cost, node count, and false-positive risk. Add consecutive-failure and success thresholds, then verify the resulting removal and recovery time under load.
Can health checks impact system performance?
Yes. Poorly designed probes can consume resources or amplify an incident across many nodes. Keep the endpoint bounded, avoid optional dependency work, spread probe load where supported, and monitor the check itself.
How do you secure health check endpoints?
Limit network exposure, return minimal status, and use HTTPS when probe traffic crosses an untrusted network. Add authentication only when the gateway can supply and protect the required probe credentials; keep detailed diagnostics on a separate restricted path.
What tools can you use to automate health checks?
Configure continuous active and passive checks in the gateway. Use Infrastructure-as-Code to version their endpoints, thresholds, and timeouts, and use CI/CD to validate configuration plus post-deployment behavior. Pipeline tools do not replace the gateway's runtime health-check loop.



