Skip to content

VpcService

Source: src/Cloudflare/VpcService/VpcService.ts

A Cloudflare VPC service that exposes a private host (IP or hostname) reachable through a Cloudflare Tunnel for Workers VPC.

Hostname through a tunnel

const tunnel = yield* Cloudflare.Tunnel("MyTunnel");
const service = yield* Cloudflare.VpcService("Internal", {
host: {
hostname: "internal.example.com",
resolverNetwork: { tunnelId: tunnel.tunnelId, resolverIps: ["10.0.0.53"] },
},
});

IPv4 with explicit ports

const service = yield* Cloudflare.VpcService("DevServer", {
httpPort: 5173,
host: { ipv4: "192.168.1.100", network: { tunnelId: tunnel.tunnelId } },
});