Cloudflare Containers and Sandboxes Now Support Direct HTTP Connection to Workers
Key Points
- Direct HTTP connection between Containers/Sandboxes and Workers
- Access Workers bindings (KV, R2) via standard HTTP requests
- Built-in Durable Object state management with SQLite
Summary
Cloudflare Containers and Sandboxes now support direct HTTP connections to Workers, enabling seamless integration between containerized applications and Workers functions. This feature allows containers to access Workers bindings like KV and R2 storage through standard HTTP requests.
Key Points
- Outbound HTTP Handlers: Define
outboundandoutboundByHosthandlers to capture and process HTTP requests from containers - Workers Bindings Access: Containers can access KV, R2, and other Workers bindings through HTTP calls to specific hostnames
- Durable Object Integration: Use
ctx.containerIdto reference automatically provisioned Durable Objects with built-in SQLite database - Secure Communication: Traffic between containers and Workers runs securely on the same machine
- HTTP Only: Currently supports HTTP traffic only; HTTPS interception coming soon
- Easy Upgrade: Available in
@cloudflare/containersv0.2.0+ and@cloudflare/sandboxv0.8.0+