Skip to content

Cloudflare.Healthcheck reference

Source: src/Cloudflare/Healthcheck/Healthcheck.ts

A Cloudflare standalone Health Check — monitors an origin server from Cloudflare’s edge and powers Health Check notifications and analytics.

Zone-scoped and available on paid zone plans (Pro: 2 checks, Business: 10, Enterprise: more). Distinct from Load Balancing Monitors, which are account-scoped and attached to LB pools.

Every property except zoneId is mutable in place (the API supports full PUT updates, including renames); changing the zone triggers a replacement.

Safety: health checks carry no ownership markers, so when there is no prior state read matches by deterministic name and reports an existing check as Unowned — the engine refuses to take it over unless --adopt (or adopt(true)) is set.

Basic HTTP health check

const check = yield* Cloudflare.Healthcheck.Healthcheck("origin-check", {
zoneId: zone.zoneId,
address: "origin.example.com",
});

HTTPS health check with custom path and expected codes

const check = yield* Cloudflare.Healthcheck.Healthcheck("api-health", {
zoneId: zone.zoneId,
address: "api.example.com",
type: "HTTPS",
interval: 60,
retries: 2,
timeout: 5,
httpConfig: {
path: "/healthz",
expectedCodes: ["200"],
followRedirects: true,
},
});
const check = yield* Cloudflare.Healthcheck.Healthcheck("db-port", {
zoneId: zone.zoneId,
address: "db.example.com",
type: "TCP",
tcpConfig: { port: 5432 },
});
const check = yield* Cloudflare.Healthcheck.Healthcheck("origin-check", {
zoneId: zone.zoneId,
address: "origin.example.com",
suspended: true,
});