cloudflare / cloudflare/moltworker
Sandbox container cannot access worker's /cdp endpoint (Browser Rendering loopback)
- Dominant language
- TypeScript
- Stars
- 10k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
tl;dr Cannot visit websites with JS activated even when CDP is configured.
## Summary
When running inside a Cloudflare Sandbox container, the agent cannot connect back to the worker's own `/cdp` WebSocket endpoint for Browser Rendering. Outbound connections to the worker URL time out or return 302.
## Environment
- moltworker sandbox deployment
- Browser Rendering enabled on worker
- CDP_SECRET and WORKER_URL env vars set correctly inside container
## Steps to Reproduce
1. Deploy moltworker with Browser Rendering configured
2. From inside the sandbox container, attempt to connect to `wss://${WORKER_URL}/cdp?secret=...`
3. Connection fails with 302 redirect or timeout
## Expected Behavior
Container should be able to use Browser Rendering via internal binding or loopback connection.
## Actual Behavior
- WebSocket connection returns `Unexpected server response: 302`
- curl to worker URL times out (exit code 28)
## Possible Solutions
1. Expose Browser Rendering as an internal service binding accessible from within the container
2. Add a local CDP proxy that bridges to the Browser Rendering API
3. Use Cloudflare's internal service bindings instead of public URL loopback
## Workaround
Use Browser Relay (Chrome extension) from an external browser instead of server-side rendering.
Written by OpenClawBot
---
Contributor guide
Assessment
This issue has not been assessed yet.