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.
Before you start
Section titled “Before you start”- A server connected with a runner.
- The
reocloCLI signed in to your organization. - A web service on the server. This guide uses Grafana on port 3000.
Open a service
Section titled “Open a service”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.
-
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 -
Save the tunnel.
Terminal window reoclo tunnel add grafana --server prod-1 --kind https --target 3000 -
Open the URL that
reoclo tunnel status grafanashows in theLOCALcolumn: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.
Why the URL has :8443
Section titled “Why the URL has :8443”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.
Drop the port
Section titled “Drop the port”To get https://grafana.prod-1.reoclo.localhost with no port, install the hosts helper with port 443 relaying:
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.
Safari and other system-resolver apps
Section titled “Safari and other system-resolver apps”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.
reoclo hosts setupreoclo hosts lsChoose your own hostname
Section titled “Choose your own hostname”The default hostname is <tunnel>.<server>.reoclo.localhost. Pass --hostname to pick another name under reoclo.localhost:
reoclo tunnel add grafana --server prod-1 --target 3000 --hostname metrics.reoclo.localhostPassing --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:
reoclo tunnel trust --domain internalreoclo hosts setup --allow-suffix internalreoclo tunnel add grafana --server prod-1 --target 3000 --hostname grafana.internalThe 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.enabledtotrueinabout:config, or import the file thatreoclo tunnel ca-pathprints.
Services that check the Host header
Section titled “Services that check the Host header”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.
Remove it
Section titled “Remove it”reoclo tunnel rm grafana # remove one tunnel and its hostnamereoclo tunnel untrust # remove the CA from your system and delete its keyreoclo hosts uninstall # remove the hosts helper and the hosts blockTroubleshooting
Section titled “Troubleshooting”| Symptom | Cause and fix |
|---|---|
| The browser warns about the certificate | The CA is not trusted yet. Run reoclo tunnel trust. In Firefox, see above |
| The connection is refused or the handshake fails | The 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 port | Port 8443 is in use. Change https_port and restart the daemon |
| The hostname does not resolve | Run reoclo hosts setup, or use a program that resolves .localhost itself |
hosts setup --port-443 stops with an error | Another program answers on port 443. Stop it, or keep the :8443 URLs |
reoclo tunnel daemon status shows ca_stale: true | tunnels.yaml allows suffixes the CA does not cover. Run reoclo tunnel trust again |
reoclo tunnel daemon status shows ca_trusted: false | The system does not trust the CA. Run reoclo tunnel trust |
Related
Section titled “Related”reoclo tunnel: saved tunnels, states and the daemonreoclo hosts: the hosts helper and the port 443 relay