Ntwine

Cloudflare Tunnel

Open your board at your own domain without opening a port.

A tunnel lets you reach your board from anywhere without opening a port. You'll need a domain you control on Cloudflare, and cloudflared on your PATH.

Create the tunnel once

cloudflared tunnel login
cloudflared tunnel create my-board
cloudflared tunnel route dns my-board board.example.com

login opens a browser so you can pick your zone. create writes a credentials JSON under ~/.cloudflared/ and prints the tunnel id. route dns adds the CNAME that points your hostname at the tunnel.

Point the tunnel at the board

Write this to ~/.cloudflared/ntwine.yml, which Ntwine looks for by name. Keep it out of config.yml, since its catch-all shadows other tunnels:

~/.cloudflared/ntwine.yml
tunnel: my-board
credentials-file: /Users/you/.cloudflared/<tunnel-id>.json

ingress:
  - hostname: board.example.com
    service: http://127.0.0.1:9393
  - service: http_status:404

Let Ntwine run it

  press R, choose Cloudflare Tunnel

  Hostname  board.example.com
  Tunnel    my-board

Ntwine asks which tunnel serves the hostname instead of guessing from its first label, because a tunnel is rarely named after its host. It remembers both answers, and checks that cloudflared is on this machine before accepting them.

Ntwine then runs the tunnel beside the board, so the two share a lifetime. A tunnel that outlives its board serves Cloudflare error 1033 to anyone who visits. A board that outlives its tunnel is unreachable with nothing to say why.

On this page