Skip to content

PagesDomain

Source: src/Cloudflare/Pages/Domain.ts

A custom domain attached to a Cloudflare Pages project.

Attaching a domain starts Cloudflare’s validation flow: the domain must resolve to the project (typically via a CNAME record pointing at the project’s *.pages.dev subdomain) before its status becomes active. The resource does not wait for activation — compose it with Cloudflare.DnsRecord to create the CNAME, and certificate issuance completes asynchronously.

Both properties are the attachment’s identity, so every change triggers a replacement (detach + attach).

const project = yield* Cloudflare.PagesProject("site", {});
const domain = yield* Cloudflare.PagesDomain("site-domain", {
projectName: project.name,
name: "www.example.com",
});
yield* Cloudflare.DnsRecord("site-cname", {
zoneId: zone.zoneId,
name: "www.example.com",
type: "CNAME",
content: project.subdomain,
proxied: true,
});