Putting a Home Mac on Public HTTPS Without Port Forwarding: Four Checks on Cloudflare Tunnel's First Boot
The first goal in Part 1 was to see one "hello" line from the Spring API at https://forge-fate.com. That meant connecting the public domain to Docker containers on my home Mac.
The setup had four containers and a Cloudflare tunnel. Getting there meant sorting out a connector installed on the host, addresses inside containers, DNS, and a certificate that was already working.
Starting point: four containers and a tunnel token
The whole setup lives in one docker compose file: PostgreSQL, the Spring API (blog-api), the Next.js web app (blog-web), and the tunnel connector cloudflared. The cloudflared service runs with the token from the dashboard.
This is the configuration from the first boot in June 2026. The image tag records the version used then; it is not a version recommendation for a new installation today.
cloudflared: image: cloudflare/cloudflared:2024.12.2 command: tunnel --no-autoupdate run --token ${TUNNEL_TOKEN}This tunnel was managed through the dashboard, so I did not use a local config.yml. Which domain goes to which service is stored in the Cloudflare dashboard, and cloudflared fetches that configuration using the token. The token lives only in infra/.env, which never goes into Git.
1. Two connectors on the same tunnel
When you create a tunnel, the dashboard shows an install command of the form cloudflared service install <token>. Running it registers cloudflared as a system service on the Mac. While moving to the production Mac, I had already run that command once.
But this blog runs cloudflared as a Docker container. So I ended up with two connectors on the same tunnel.
Preparing diagram.
Diagram source
flowchart TB
CF[Cloudflare edge] --> H[cloudflared installed on the host]
CF --> C[cloudflared container]
H -.->|Can't resolve blog-web| X[Connection fails]
C -->|Docker internal network| W[blog-web]The problem was the host-side connector. The target registered in the dashboard was http://blog-web:3000, and the name blog-web only resolves inside Docker's internal network. The cloudflared running on the host could not find it, so any request routed to it was bound to fail.
The assumption of a fifty-fifty split
My notes said that half the requests would go to the host and fail, but they contained no measurement of the failure rate. The official documentation does not describe a fifty-fifty split either. When several connectors (replicas) serve one tunnel, Cloudflare sends each request to the geographically closest one. If that connection fails, it retries with another replica, but there is no guarantee which one gets picked, and there is no round-robin style steering. [S1]
Having both connectors on the same Mac does not establish how requests are divided. The issue I could identify was that the host connector could not resolve the target service name. The retry behavior above concerns a failed connection from Cloudflare to a connector; it does not guarantee recovery when the connector cannot reach the origin service.
I removed the host service and kept only the container connector.
sudo cloudflared service uninstallThe dashboard command installs a connector on the host. In this setup, the container connects to the target service, so I only needed the token.
2. Inside a container, localhost is that container
I entered http://blog-web:3000 as the Service URL in the dashboard. The notes explain how that address differs from localhost:3000. They do not contain a log showing that I entered the wrong value and observed a failure.
But cloudflared runs inside a container, and inside a container localhost means that container itself. Nothing listens on port 3000 in the cloudflared container, so entering localhost:3000 gets you a refused connection.
Preparing diagram.
Diagram source
flowchart TB
subgraph N[Docker internal network]
C[cloudflared container] -->|http://blog-web:3000| W[blog-web container]
C -.->|localhost:3000| L[The cloudflared container itself · nothing on port 3000]
endDocker Compose lets services on the same network find each other by service name. [S3] The address to use in this setup was http://blog-web:3000.
Running on the host changes the address
If cloudflared had been installed on the host, localhost:3000 would actually have been correct, because the compose file published the web port to 127.0.0.1:3000 on the host.
Where cloudflared runs | Target address | Why |
|---|---|---|
| Docker container | http://blog-web:3000 | Resolves the service name on the shared internal network |
| Host service | http://localhost:3000 | Reaches the port published on the host |
3. The tunnel existed, but the domain didn't respond
I had created the tunnel and pasted in the token, but https://forge-fate.com would not open. I started with DNS.
$ nslookup forge-fate.com 1.1.1.1*** Can't find forge-fate.com: No answerThe domain's nameservers were already delegated to Cloudflare, yet the root domain had no records at all.
A running tunnel and the decision about which domain's traffic goes into it turned out to be separate steps. For a public domain to reach a tunnel, its CNAME record has to point at the tunnel's own address (<UUID>.cfargotunnel.com). [S2] Adding a published application route in the dashboard can create the DNS record as well. It is also possible to add the DNS record manually.
These were the menu labels and values I used in June 2026:
- Networking → Tunnels → the tunnel → Routes tab
- Add route → Published application
- Leave the subdomain empty (root), domain
forge-fate.com, type HTTP, targethttp://blog-web:3000
After saving, Cloudflare created a proxied CNAME record, and only then did DNS start answering.
Menu labels that differed from the notes
The plan I had written before starting said "Public Hostnames tab → Add a public hostname". The actual dashboard had no such menu. The same feature had become "Routes → Add route → Published application", with the same fields to fill in. If menu names in screenshots or blog posts (this one included) don't match, go by what the current dashboard says.
4. No separate certificate setup was needed
Once the site opened, I checked the certificate issuer. HTTPS worked without a separate Let's Encrypt setup.
$ openssl s_client -connect forge-fate.com:443 ... | openssl x509 -issuer ...issuer = Google Trust Services (CN=WE1)Cloudflare's Universal SSL handles certificate issuance, installation, and renewal. [S4] The certificate authority in the output was Google Trust Services. The http:// target belongs to the internal segment after the tunnel.
| Segment | Encryption |
|---|---|
| Browser ↔ Cloudflare edge | HTTPS with the Universal SSL certificate |
| Cloudflare edge ↔ home Mac | Encrypted tunnel that cloudflared opened outward |
cloudflared ↔ blog-web | Plain HTTP, but only inside Docker's internal network on the Mac |
Along this public request path, the segments crossing the internet are encrypted, and the plain HTTP segment stays inside the Mac.
Final checks
After removing the host connector and setting the target address and DNS, I checked the path from the inside out. The certificate needed only a status check, not a separate setup.
| Check | How | Result |
|---|---|---|
| Containers up | docker compose ps | All 4 running |
| Tunnel connected | cloudflared logs | 4 × Registered tunnel connection |
| API alone | Call /api/hello from the host | {"message":"hello from blog-api"} |
| Web → API over the internal network | Call the local web port on the host | Response includes hello from blog-api |
| Public URL | curl https://forge-fate.com | Response includes hello from blog-api |
| Certificate | openssl s_client | Google Trust Services certificate provided through Universal SSL |
The four connections in the logs are for redundancy. By default cloudflared opens four outbound connections spread across at least two data centers. [S1] That day's record shows connections to Seoul edge locations (icn01, icn05, icn06).
I checked from the inside out to narrow things down if something failed. If the API call alone fails, there's no point looking at the tunnel. If the internal call works but the public URL doesn't, the tunnel, DNS, edge configuration, and TLS are among the next things to check.
There were later incidents in which tunnel connectivity kept the site from opening. In July, it stopped after an unexplained termination signal, and I only noticed nine hours later. In September, the whole site went down with HTTP 530; rolling back cloudflared did not restore service, and recovery followed a Docker Desktop restart. Part 5 covers the September recovery and compares it with the July record.
The next post is about the database: the day ddl-auto=update broke on a single NOT NULL foreign key, and why I moved to Flyway.
Sources
- [S1] Tunnel availability and failover | Cloudflare Docs | Updated 2026-04-17, checked 2026-10-28 | https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/configure-tunnels/tunnel-availability/ ↩
- [S2] DNS records (Cloudflare Tunnel) | Cloudflare Docs | Checked 2026-10-28 | https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/routing-to-tunnel/dns/ ↩
- [S3] Networking in Compose | Docker Docs | Checked 2026-10-28 | https://docs.docker.com/compose/how-tos/networking/ ↩
- [S4] Universal SSL | Cloudflare Docs | Checked 2026-10-28 | https://developers.cloudflare.com/ssl/edge-certificates/universal-ssl/ ↩
About these records
This post is based on the work notes and command output I recorded on June 27, 2026, when I first put this blog on its public domain. Cloudflare dashboard menu names may have changed since then. I rechecked how things work against the official Cloudflare and Docker documentation, and I leave out tokens and tunnel IDs.
Report an error or share feedback
Open a draft with this article’s title and URL. Review the message and recipient before sending.
Open email draftIf no email app opens, copy these details into your usual email service.
Related posts
Backend & Infrastructure Seven Steps to Verify API Integration Between Docker Compose Services
Verify DNS, readiness, authentication, response contracts, creation, readback, and deletion in an isolated Compose example with logs and a token-free archive.
Backend & Infrastructure Spring Boot 4.1 Jackson Settings: Comparing Duplicate JSON Keys and BigDecimal Output
Compare two Jackson settings in the same Spring Boot 4.1.0 app using the recorded six tests and six HTTP requests for duplicate JSON keys and BigDecimal notation.