All posts

What Cloudflare Workers TCP Proxies Actually Do and When to Use Them

You know the moment. You spin up a new service, it lives behind some private network, and someone says, “Just open the port.” That’s when a small voice in your head asks if this might end with a security incident call at 2 a.m. Enter Cloudflare Workers TCP Proxies — a method to handle inbound and outbound connections without duct-taping your way through firewalls. Cloudflare Workers give you programmable logic at the edge. TCP proxies give you stable network tunnels that move traffic securely.

Free White Paper

End-to-End Encryption: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

You know the moment. You spin up a new service, it lives behind some private network, and someone says, “Just open the port.” That’s when a small voice in your head asks if this might end with a security incident call at 2 a.m. Enter Cloudflare Workers TCP Proxies — a method to handle inbound and outbound connections without duct-taping your way through firewalls.

Cloudflare Workers give you programmable logic at the edge. TCP proxies give you stable network tunnels that move traffic securely. Together, they let you control who connects, what data passes, and how the connection behaves, all while staying serverless. It’s cloud-native network plumbing done with restraint and a little swagger.

A Cloudflare Worker can act as a lightweight request router. When you add a TCP Proxy element, you turn that logic into transport-level access — connecting users or systems through Cloudflare’s edge to your internal service. Each request can be validated with headers, tokens, or an identity provider before it ever hits your actual servers. That’s identity-aware networking, minus the leaden VPN client.

Here’s the short version in case you just skimmed down for it: Cloudflare Workers TCP Proxies let you inspect, authenticate, and route TCP connections through Cloudflare’s global edge before they reach your origin, improving security and performance.

How it works in practice

When a connection arrives, the Worker script defines what happens next. You can look up user claims from OIDC, map them against an access policy similar to AWS IAM rules, and decide whether to allow the traffic. Once approved, the TCP proxy forwards data directly to the target host. Every packet path and decision point is auditable, and you can enforce client verification without touching the origin’s firewall.

Continue reading? Get the full guide.

End-to-End Encryption: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Best practices worth knowing

Use short-lived tokens for session-level access. Rotate secrets often. Tie Worker authentication to providers like Okta or any SAML-based service. Keep logs minimal but structured enough for SOC 2 audits. And always monitor latency at both the Worker and origin levels, since distributed routing can add a few milliseconds that matter under load.

The benefits that matter

  • Enforces identity-based access control over raw TCP.
  • Simplifies complex network exposure patterns into policy code.
  • Cuts down on SSH tunnels, custom bastions, and VPN sprawl.
  • Improves visibility and auditing for compliance teams.
  • Leverages Cloudflare’s global network for faster edge handshakes.

Why developers actually like it

Developers get faster onboarding because access policies are code, not tickets. Debugging gets easier because you see connection traces right where logic lives. And with platforms like hoop.dev, those access rules can become guardrails that enforce who touches what, directly from your pipeline. Security moves from a blocker to a background process.

A note on AI and automation

AI-driven agents now trigger infrastructure changes automatically. Cloudflare Workers TCP Proxies fit nicely here because they set boundaries for what those agents can reach. When prompts or scripts run wild, edge access rules keep your private systems private.

Quick question: Is using Cloudflare Workers as a TCP proxy secure?

Yes, when combined with proper identity validation, short-lived credentials, and strict routing logic, Cloudflare Workers TCP Proxies are a secure and scalable way to expose private services without broad network access.

The bottom line: Cloudflare Workers TCP Proxies turn brittle network access into flexible policy logic that travels with your app.

See an Environment Agnostic Identity-Aware Proxy in action with hoop.dev. Deploy it, connect your identity provider, and watch it protect your endpoints everywhere—live in minutes.

Get started

See hoop.dev in action

One gateway for every database, container, and AI agent. Deploy in minutes.

Get a demoMore posts