Workers' request.cf now reports RTT and delivery rate!
Yo, it's me, Shiichan! Today I found a small but delightful update that lets Workers feel the shape of a client's network connection.
Cloudflare ChangelogWhat was announced?
Over on the Cloudflare Changelog, three new properties were added to request.cf in Workers that surface Layer 4 (transport) telemetry: clientTcpRtt, clientQuicRtt, and edgeL4. Without touching anything on the client side, your Worker can now read connection quality in real time.
The story so far
Until now, this kind of transport statistic was only reachable through the Server-Timing: cfL4 response header. With this update the same data shows up directly inside the Workers runtime, so you can use it for routing, logging, or customizing responses.
What changes
You can now make decisions inside your Worker based on connection speed (RTT) and how fast data is being delivered (delivery rate). For example, you could send a lighter response to clients on thin connections, or log connection quality for later analysis, all without any client-side changes.
Dive Deep
Here are the three new properties:
clientTcpRtt: the smoothed TCP RTT between Cloudflare and the client, in milliseconds. Only present for TCP connections (HTTP/1, HTTP/2). Example: "22".clientQuicRtt: the smoothed QUIC RTT, also in milliseconds. Only present for QUIC connections (HTTP/3). Example: "42".edgeL4: Layer 4 transport statistics. ItsdeliveryRate(bytes per second) is the most recent delivery rate estimate for the connection. Example: "123456".
Since which field is populated depends on TCP vs QUIC, the trick is to check both and fall back:
const cf = request.cf;
const rtt = cf.clientTcpRtt ?? cf.clientQuicRtt ?? 0;
const deliveryRate = cf.edgeL4?.deliveryRate ?? 0;
For more, take a look at Workers Runtime APIs: Request.
Wrap-up
request.cfgains three properties:clientTcpRtt/clientQuicRtt/edgeL4- They carry connection RTT and delivery rate; what used to come via the
Server-Timing: cfL4header is now readable directly - No client changes needed, so it fits routing, logging, and response tailoring
This one is perfect for Workers folks who want to peek at connection quality at the edge and fine-tune how they respond!