Skip to content

Local HTTPS for Tunnels

A saved https tunnel puts a web service that runs on one of your servers at a hostname on your machine, like https://grafana.prod-1.reoclo.localhost:8443. The certificate comes from a certificate authority (CA) that only exists on your machine, so your browser shows no warning.

Use it for dashboards, admin panels and anything else that listens on 127.0.0.1 on a server and should not be open to the internet. The traffic rides the server’s runner, so you need no SSH keys and no inbound firewall rule.

  • A server connected with a runner.
  • The reoclo CLI signed in to your organization.
  • A web service on the server. This guide uses Grafana on port 3000.

To do every one-time step at once (trusting the CA, installing the hosts helper and starting the daemon at login), run reoclo tunnel setup and continue from step 2.

  1. Trust the local CA. This creates a CA for your machine and adds it to your system trust store. macOS asks for your login password. On Linux it runs sudo.

    Terminal window
    reoclo tunnel trust
  2. Save the tunnel.

    Terminal window
    reoclo tunnel add grafana --server prod-1 --kind https --target 3000
  3. Open the URL that reoclo tunnel status grafana shows in the LOCAL column:

    https://grafana.prod-1.reoclo.localhost:8443

The first connection opens the session to the server, so it takes a moment. The tunnel then stays saved. It survives closing the terminal and comes back after a restart of the tunnel daemon.

The default URL carries :8443. macOS and Linux do not let an ordinary user listen on port 443, so the tunnel daemon listens on port 8443 on 127.0.0.1 and ::1. If another program already uses port 8443, every https tunnel shows failed with that reason. Set https_port in tunnels.yaml to another port and restart the daemon with reoclo tunnel daemon stop and reoclo tunnel daemon start.

To get https://grafana.prod-1.reoclo.localhost with no port, install the hosts helper with port 443 relaying:

Terminal window
reoclo hosts setup --port-443

--port-443 makes a small root helper listen on 127.0.0.1:443 and [::1]:443 and pass the bytes to port 8443. It refuses to start while another program already answers on port 443, such as a local web server, a proxy or a Docker container. Without that check the relay would take over that program’s traffic. If something answers on port 443, setup stops with an error and you keep the :8443 URLs. See reoclo hosts for the details.

Programs that use the system resolver need a hosts entry for the hostname. reoclo hosts setup installs the helper that writes the entries. Run it once and every saved tunnel hostname follows from then on.

Terminal window
reoclo hosts setup
reoclo hosts ls

The default hostname is <tunnel>.<server>.reoclo.localhost. Pass --hostname to pick another name under reoclo.localhost:

Terminal window
reoclo tunnel add grafana --server prod-1 --target 3000 --hostname metrics.reoclo.localhost

Passing --hostname without --kind makes the tunnel an https tunnel.

To use your own suffix, such as grafana.internal, allow it in two places, because the CA and the hosts helper each check it:

Terminal window
reoclo tunnel trust --domain internal
reoclo hosts setup --allow-suffix internal
reoclo tunnel add grafana --server prod-1 --target 3000 --hostname grafana.internal

The CA can only sign for reoclo.localhost and the suffixes you allow, so a leaked key cannot sign for any other domain. Changing the suffixes issues a new CA and asks you to trust it again.

Programs that do not read the system trust store

Section titled “Programs that do not read the system trust store”

Node, Bun and Firefox keep their own trust settings.

  • Node and Bun: set NODE_EXTRA_CA_CERTS="$(reoclo tunnel ca-path)".
  • curl: pass --cacert "$(reoclo tunnel ca-path)".
  • Firefox: set security.enterprise_roots.enabled to true in about:config, or import the file that reoclo tunnel ca-path prints.

The tunnel passes the request through unchanged. Your service sees the hostname you opened, for example grafana.prod-1.reoclo.localhost:8443. A service that checks the Host header, such as Vite or Django with ALLOWED_HOSTS, must allow that hostname.

The tunnel does not parse HTTP, so WebSockets and server-sent events work. It offers http/1.1 only.

Terminal window
reoclo tunnel rm grafana # remove one tunnel and its hostname
reoclo tunnel untrust # remove the CA from your system and delete its key
reoclo hosts uninstall # remove the hosts helper and the hosts block
SymptomCause and fix
The browser warns about the certificateThe CA is not trusted yet. Run reoclo tunnel trust. In Firefox, see above
The connection is refused or the handshake failsThe tunnel is down (reoclo tunnel up <name>), the hostname does not match the tunnel, or there is no CA yet
The tunnel shows failed and names a portPort 8443 is in use. Change https_port and restart the daemon
The hostname does not resolveRun reoclo hosts setup, or use a program that resolves .localhost itself
hosts setup --port-443 stops with an errorAnother program answers on port 443. Stop it, or keep the :8443 URLs
reoclo tunnel daemon status shows ca_stale: truetunnels.yaml allows suffixes the CA does not cover. Run reoclo tunnel trust again
reoclo tunnel daemon status shows ca_trusted: falseThe system does not trust the CA. Run reoclo tunnel trust