Gateway, Cloudflare Mesh, Workers VPC - Filter Workers' public Internet traffic using Gateway policies
Key Points
- Worker egress routed via Gateway
- Gateway DNS/HTTP/Network policies apply
- Worker traffic appears in Gateway logs
Summary
Cloudflare Workers that use a VPC Network binding (network_id: "cf1:network") now egress to the public Internet through Cloudflare Gateway. Worker-originated traffic is subject to the same Zero Trust Gateway policies (DNS, HTTP, Network) as WARP users and is logged for visibility and auditing.
Key Points
- Enable egress: add a VPC network binding in wrangler with binding: "EGRESS", network_id: "cf1:network", remote: true.
{
"vpc_networks": [
{
"binding": "EGRESS",
"network_id": "cf1:network",
"remote": true
}
]
}
[[vpc_networks]]
binding = "EGRESS"
network_id = "cf1:network"
remote = true
- Usage: call env.EGRESS.fetch("https://api.example.com/data") from your Worker; the request is routed through Gateway and subject to policies.
const response = await env.EGRESS.fetch("https://api.example.com/data");
- Enforcement: existing Gateway DNS, HTTP, and Network policies (allow/block lists, DNS category filtering, HTTP destination rules) apply to Worker egress.
- Observability: Worker egress appears in Gateway DNS, HTTP, and Network logs so you can audit destinations and times.
For configuration options see the VPC Networks docs and for policy authoring see Cloudflare Gateway traffic policies.