Skip to content

FallbackOrigin

Source: src/Cloudflare/CustomHostname/FallbackOrigin.ts

The Cloudflare for SaaS fallback origin of a zone.

A zone-level singleton: requests to any of the zone’s custom hostnames that don’t have a customOriginServer are routed to this origin. Setting a fallback origin implicitly enables Cloudflare for SaaS on the zone.

Safety: when there is no prior state, read reports an existing fallback origin as Unowned, so the engine refuses to overwrite an out-of-band configuration unless --adopt (or adopt(true)) is set.

const record = yield* Cloudflare.DnsRecord("Origin", {
zoneId: zone.zoneId,
name: "origin.my-saas.com",
type: "A",
content: "203.0.113.1",
proxied: true,
});
const fallback = yield* Cloudflare.FallbackOrigin("Fallback", {
zoneId: zone.zoneId,
origin: record.name,
});