Workers - Connect handler no longer requires experimental flag
The connect() handler for Workers is now generally available and no longer requires an experimental compatibility flag. This handler enables Workers to accept TCP connections forwarded from other Workers via service bindings and perform raw byte read/write operations using a Socket object.
Workers can now export a connect() handler without enabling any compatibility flag. Previously, using a connect() handler required the experimental compatibility flag, which cannot be enabled in production.
A connect() handler lets a Worker accept a TCP connection forwarded from another Worker over a service binding, and read and write raw bytes on it using a Socket object:
export default {
async connect(socket, env, ctx) {
const writer = socket.writable.getWriter();
await writer.write(new TextEncoder().encode("hello"));
await writer.close();
},
};
Another Worker forwards a connection to it by calling connect() on the service binding:
export default {
async fetch(request, env) {
const socket = env.BACKEND.connect("example.com:1234");
return new Response(socket.readable);
},
};
On the connect() handler side, socket.opened resolves with localAddress set to the address the caller passed to connect().
Direct inbound TCP connections remain unsupported at present.
For more information, refer to the connect handler documentation.
Source: original entry ↗
More from Cloudflare
Follow Cloudflare to get its new changes in your feed and email digest.
DNS - Configure Advanced Custom Nameservers with nameserver sets
Nameserver sets are now available in beta for Enterprise accounts, allowing you to group custom nameserver names with Cloudflare-assigned IP addresses and assign them to multiple zones. This new approach replaces legacy custom_ns sets with reusable, immutable objects that support up to 3 IPv4 and 3 IPv6 addresses per nameserver and can leverage Advanced anycast network groups for improved resiliency.
Emergency WAF managed rule for active RCE vulnerability
Cloudflare released an emergency WAF update with a new managed rule to block exploitation of a critical remote code execution vulnerability in popular web frameworks. The Generic Rules - Remote Code Execution detection prevents attackers from executing arbitrary system commands via malicious input with invalid path sequences.
Cloudflare API MCP server sends Workers Issues as MCP Events
The Cloudflare API MCP server now exposes Workers Issues as MCP Events through webhook subscriptions, allowing agents to receive real-time notifications when production failures are detected without polling. Clients can subscribe to cloudflare.alert.workers_observability_real_time_issue scoped to an account or individual Worker.