Schedule icon
Request icon
Script icon
Process icon
Log icon
Switch icon
SlackIncomingWebhook icon
Fail icon

Caddy Reverse Proxy Upstream Health and Error Rate Sentinel

Audit Caddy reverse proxy upstream health via Admin API, classify backend degradation severity, and dispatch Slack incident alerts to prevent 502 outages.

Categories
Infrastructure

Automated reverse proxy reliability sentinel that polls the Caddy Web Server Admin API on a recurring schedule to audit backend upstream pool health, detect failing or flapping origin servers, classify degradation severity, and dispatch Slack incident alerts before cascading 502 Bad Gateway outages impact end users.

How it works

  1. A schedule trigger activates every five minutes to probe the Caddy server's administrative interface.
  2. An HTTP request task queries Caddy's /reverse_proxy/upstreams administrative endpoint to retrieve live health and request failure metrics across all backend hosts.
  3. An embedded Python script processes the upstream host records, counting active and unhealthy nodes, calculating the pool degradation percentage, and identifying specific failing addresses.
  4. An informational log task records the evaluated pool metrics and current health classification.
  5. A Switch flow control task branches execution according to the evaluated status:
    • ALL_UPSTREAMS_HEALTHY: Confirms all origin nodes are responsive and logs nominal operational telemetry.
    • PARTIAL_BACKEND_DEGRADATION: Emits a non-blocking advisory notification when failing nodes fall within allowable thresholds.
    • CRITICAL_UPSTREAM_OUTAGE: Dispatches a detailed Slack incident webhook with failing host addresses, pool failure percentages, execution deep links, and halts execution via a failure gate.
  6. An immutable final audit log records the comprehensive health verdict and upstream metrics in Kestra execution history.

What you get

  • Proactive reverse proxy health monitoring catching origin server degradation before full service outages occur.
  • Automated detection of failing microservice pods, crashed web backends, and network partition timeouts.
  • Rich Slack notifications delivering immediate diagnostic context, including specific failing host addresses.
  • Automated execution failure gates that halt dependent deployment rollouts when ingress proxies detect unhealthy upstreams.
  • Complete, immutable audit records tracking edge proxy upstream stability across deployment windows.

Who it's for

  • Platform Engineers and Site Reliability Engineers (SREs) managing Caddy edge ingress controllers and reverse proxies.
  • DevOps Teams operating microservice backends behind dynamic Caddy routing tiers.
  • Infrastructure Architects seeking automated circuit breaking and health auditing without third-party agent dependencies.

Why orchestrate this with Kestra

  • Declarative YAML orchestrates API health polling, JSON array evaluation, and incident dispatching without dedicated external monitoring daemons.
  • Native secret masking ensures Slack webhook URLs and administrative credentials remain confidential during automated runs.
  • Built-in conditional branching enables granular escalation policies tailored to infrastructure failure thresholds.
  • Centralized execution timelines provide instant diagnostic visibility into historical reverse proxy failure patterns.

Prerequisites

  • Running Caddy Web Server (standalone Docker container or host binary) with the Admin API enabled (default port 2019).
  • Network reachability between Kestra and the Caddy admin endpoint.

Secrets

  • SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to transmit critical upstream outage incident alerts.

Quick start

  1. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace or environment variables.
  2. Import this blueprint into your Kestra instance under company.infrastructure.
  3. Run a manual test execution pointing to your Caddy admin endpoint to verify connectivity and clean upstream parsing.
  4. Enable the caddy_health_audit_schedule trigger to maintain continuous 5-minute upstream monitoring.

How to extend

  • Add an automated dynamic backend reload task in the remediation branch to evict unresponsive upstream nodes via Caddy's /config/ API.
  • Correlate upstream failures with Prometheus metrics (caddy_reverse_proxy_upstreams_healthy) for time-series trend analysis.
  • Route separate alerts to PagerDuty or Opsgenie when more than 50% of the upstream server pool fails health checks.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.