r/opencodeCLI • u/Hazork_ • Oct 26 '26
Use your local OpenCode from your phone through a Cloudflare Tunnel
I built an OpenCode plugin that exposes your local daemon through a cf tunnel, protected by zero trust/access, and pairs other devices by QR code. the daemon keeps running on your computer. The plugin starts a cloudflared connector next to it, so you can reach the daemon without open ports or a VPN.
It uses the default opencode UI (the same as opencode pair command), so it never goes out of date, unlike custom mobile UIs/apps. You can also install it as a PWA.
It requires opencode v2, a cloudflare account and a domain set up.
Ask your agent to set it up by giving him this link: https://github.com/arthurfiorette/opencode-zero-trust
2
u/grabber4321 Oct 27 '26
is the URL public or its behind zero trust? whats the access looks like? do you have to login?
3
u/pungat_ 28d ago
so, it's opencode web but accessible via cloudflare?
1
u/qustrolabe 28d ago
Cool project. Unfortunately, I can just
tailscale serve --bg 45278and do pairing and get much easier and safer connection without need for domain name or any third-party installations.0
u/Dependent_Can219 Oct 27 '26
Even with the access layer in front, treat the daemon's own origin check as part of the boundary: anything that can reach the tunnel URL can attempt requests, so reject unexpected Origin headers and require auth on every route, not just the UI. The QR pairing code also needs a short expiry and single use, otherwise a screenshot becomes a permanent key. I'd log rejected requests separately from successful ones so a misconfigured rule shows up before it becomes a hole.