← Docs

Recipe: Health-aware routing rules

Route traffic based on endpoint health signals with automatic failover.

Overview

Meridian evaluates health checks every 15 seconds. When an origin fails two consecutive probes, the routing table removes it and shifts traffic to the next healthy pool member. Recovery is automatic once the origin passes three successive checks.

Configuration

rules:
  - match: /api/*
    health:
      path: /healthz
      interval: 15s
      threshold: 2
      recovery: 3
    upstreams:
      - https://primary.example.com
      - https://secondary.example.com

Behavior

  • Probes use HTTP GET with a 2-second timeout.
  • Status codes 200-299 are considered healthy.
  • Failover is sticky — in-flight requests complete on the current origin.
  • Drain mode supported via x-meridian-drain: true response header.

Tip: Combine with circuit breaker rules for defense-in-depth against cascading failures.