Tactic Remote

Cloudflare Tunnel Setup

Access your Mac from anywhere using a free Cloudflare Tunnel.

Cloudflare Tunnel lets you connect to your Mac from any network -- cellular data, a different WiFi, or across the world. No port forwarding or router changes needed.

When to use this

  • Your iPhone is on a different network than your Mac (e.g. you're on the go).
  • Your network blocks direct device-to-device connections.
  • You want HTTPS/WSS encryption by default.

How it works

cloudflared creates an outbound-only tunnel from your Mac to Cloudflare's edge. Your iPhone connects to a Cloudflare URL, and traffic is relayed to your Mac. No ports are opened on your router.

Option A: Quick tunnel (temporary)

This is the fastest way to get started. No Cloudflare account required. The URL is random and changes each time you restart.

Using the Mac app

Toggle Cloudflare Tunnel in the Mac app's settings. The app runs cloudflared internally and displays the tunnel URL.

Using the command line

Install cloudflared:

brew install cloudflared

Start a quick tunnel:

cloudflared tunnel --url http://localhost:8765

cloudflared outputs a URL like https://random-words.trycloudflare.com. Use this URL in the iPhone app (set connection mode to Public / Cloudflare).

Option B: Named tunnel (persistent URL)

For daily use, a named tunnel gives you a stable URL that doesn't change.

Requirements:

  • A free Cloudflare account.
  • A domain managed by Cloudflare (can be a free domain).

Steps:

  1. Authenticate:

    cloudflared tunnel login
  2. Create a tunnel:

    cloudflared tunnel create claude-remote
  3. Configure DNS: point a subdomain to your tunnel:

    cloudflared tunnel route dns claude-remote remote.yourdomain.com
  4. Create a config file at ~/.cloudflared/config.yml:

    tunnel: claude-remote
    credentials-file: ~/.cloudflared/<TUNNEL_ID>.json
    ingress:
      - hostname: remote.yourdomain.com
        service: http://localhost:8765
      - service: http_status:404
  5. Run:

    cloudflared tunnel run claude-remote

Your persistent URL is now wss://remote.yourdomain.com.

Connect from iPhone

  1. In the iPhone app, switch to Public (Cloudflare) connection mode.
  2. Enter the tunnel URL (either the random *.trycloudflare.com or your named domain).
  3. Enter the API key (required for public access).
  4. Tap Connect.

Important: Always set an API key for public tunnels

When your server is reachable from the internet, an API key is mandatory. Set it as an environment variable before starting the server:

export CLAUDE_REMOTE_API_KEY="your-secret-key"

Or let the Mac app generate one for you (shown in the menu bar panel).

Troubleshooting

  • Tunnel connects but iPhone can't reach it: make sure the local server is running on the same port the tunnel points to (default: 8765).
  • DNS not resolving: for named tunnels, check that the CNAME record exists in your Cloudflare dashboard.
  • Random URL changed: quick tunnels generate a new URL each restart. Use a named tunnel for persistence.

On this page