Skip to content

MagicSite

Source: src/Cloudflare/MagicTransit/Site.ts

A Magic WAN site — represents a physical or logical network location (typically backed by a Magic WAN Connector appliance) under which LANs, WANs, and ACLs are configured.

Requires a Magic WAN subscription — accounts without it receive a typed MagicWanUnauthorized error (Cloudflare code 1025).

haMode is create-only — changing it triggers a replacement. Everything else is updated in place.

Basic site

const site = yield* Cloudflare.MagicSite("hq", {
description: "Headquarters",
location: { lat: "37.7749", lon: "-122.4194" },
});

Site with LAN and WAN

const site = yield* Cloudflare.MagicSite("hq", {});
const wan = yield* Cloudflare.MagicSiteWan("hq-wan", {
siteId: site.siteId,
physport: 1,
});
const lan = yield* Cloudflare.MagicSiteLan("hq-lan", {
siteId: site.siteId,
physport: 2,
vlanTag: 0,
});