Workers VPC - TCP connections via connect() over VPC Networks
VPC Network bindings now support the connect() Socket API for raw TCP connections to private destinations, enabling Workers to open TCP sockets to services like Redis, Memcached, and MQTT through Cloudflare Tunnel, Mesh, or WAN on-ramps.
VPC Network bindings now support the connect() Socket API for raw TCP connections to private destinations, in addition to HTTP traffic via fetch().
This means Workers can now open TCP sockets to any private service reachable through the bound Cloudflare Tunnel, Cloudflare Mesh, or Cloudflare WAN on-ramp — Redis, Memcached, MQTT, custom binary protocols, or any other TCP-based service.
{
"$schema": "./node_modules/wrangler/config-schema.json",
"vpc_networks": [
{
"binding": "PRIVATE_NETWORK",
"network_id": "cf1:network",
"remote": true
}
]
}[[vpc_networks]]
binding = "PRIVATE_NETWORK"
network_id = "cf1:network"
remote = true
At runtime, use connect() on the binding to open a TCP socket to a private destination:
export default {
async fetch(request: Request, env: Env) {
// Open a TCP connection to a private Redis instance
const socket = await env.PRIVATE_NETWORK.connect("10.0.1.50:6379");
// Write a Redis PING command
const writer = socket.writable.getWriter();
await writer.write(new TextEncoder().encode("PING\r\n"));
await writer.close();
return new Response(socket.readable);
},
};
Note
connect() over VPC Networks currently supports plaintext TCP only.
For more details, refer to VPC Networks and the Workers Binding API.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
Cloudflare One Client for macOS 2026.8.2100.0
GA release for macOS Cloudflare One Client with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster connects with lower memory use, and numerous reliability fixes across DNS, reauthentication, and client stability.
Cloudflare One Client for Windows 2026.8.2100.0
This GA release improves split tunnel reliability, adds support for non-RFC 1918 local networks, optimizes connection performance with faster reconnections and lower memory usage, and includes numerous bug fixes for DNS, registration, and network handling. The client now features a service recovery mechanism that automatically restarts on system unlock and better handles large hosts files without blocking traffic.
Cloudflare One Client for Linux 2026.8.2100.0
New GA release for Linux with improved split tunnel handling that no longer briefly blocks traffic during reconnects, support for non-RFC 1918 local IPv4 networks, faster tunnel reconnections, and lower memory usage. Includes numerous stability and reliability fixes for DNS, reconnection behavior, and crash issues.