r/opencodeCLI • • Oct 26 '26

Use your local OpenCode from your phone through a Cloudflare Tunnel

Post image

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

13 Upvotes

7 comments sorted by

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/Hazork_ Oct 27 '26

You can set up both, (the readme documents both), although I 100% recommend you to put it behind Cloudflare Access.

Then scanning the QR gets you to a cloudflare zero trust login page that once logged it, it automatically connects to the running opencode (the qrcode has a 5m valid OTP code so no opencode web login is required for you)

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 45278 and 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.

1

u/Hazork_ Oct 27 '26

Did you read the project before commenting this?