Circuit Breakers

Automatically detect failing backends and stop sending traffic to them. Circuit breakers prevent cascade failures and give your upstream services time to recover.

Quickstart

Enable a circuit breaker on your route configuration to automatically trip when the backend begins to fail, giving it 30 seconds to recover before allowing new requests.

{
  "circuitBreaker": {
    "enabled": true,
    "failureThreshold": 5,
    "monitoringWindow": 60000,
    "recoveryTimeout": 30000,
    "successThreshold": 2
  }
}

Reference

Nolxy implements a per-route circuit breaker with three states:CLOSED (normal operation),OPEN (tripped, returns 503), andHALF-OPEN (probing for recovery).

FieldTypeDefaultRequiredDescription
enabledbooleanfalseNoWhether the circuit breaker is active for this route.
failureThresholdinteger5NoNumber of failures (5xx or timeouts) before the circuit opens.
monitoringWindowinteger (ms)60000NoTime window to count failures before resetting the count.
recoveryTimeoutinteger (ms)30000NoHow long the circuit stays OPEN before transitioning to HALF-OPEN to test recovery.
successThresholdinteger2NoNumber of successful requests needed in HALF-OPEN state to fully close the circuit again.

Examples

Aggressive Breaker for Fragile Upstreams

Trip the circuit breaker after only 2 failures within a 10-second window, and wait a full minute before attempting to send traffic again.

{
  "circuitBreaker": {
    "enabled": true,
    "failureThreshold": 2,
    "monitoringWindow": 10000,
    "recoveryTimeout": 60000,
    "successThreshold": 1
  }
}

Common Errors

503 Service Unavailable

Circuit Breaker OPEN

Fix: The upstream backend is failing. The 503 response includes a Retry-After header indicating when the gateway will test the connection again. Ensure your upstream service is healthy.

HTTP/1.1 503 Service Unavailable
Retry-After: 30

{
  "error": "Service Unavailable",
  "message": "Circuit breaker is open",
  "statusCode": 503
}

Plan Requirements

Circuit Breakers are available on paid plans.