Architecture decision
ADR-003: Cloudflare Tunnel for production ingress
An outbound tunnel keeps application ports private and makes the intended public route explicit.
Context
Ask Habib needs a public HTTPS entry point while its application services remain private. The initial deployment should make the intended route explicit and avoid an accidental second route that bypasses its edge and proxy controls.
Administrative access and public application traffic are separate concerns. The ingress decision should not require exposing the application merely to administer the host.
Decision
Use Cloudflare Tunnel to connect the origin to Cloudflare. The connector opens outbound connections and the public hostname maps to an internal web service. The application therefore needs no public inbound listener on the origin. Cloudflare documents this connection model.
The request path is Cloudflare, the tunnel connector, Caddy, and then the Go API when an API route is requested. Caddy serves the static frontend and proxies API requests. Container application services are not published to the host.
Visitor identity is accepted only through the configured proxy peers. A header name alone is not evidence of a trusted source. The API ignores identities from other peers, and normal application logs exclude raw visitor addresses.
Alternatives considered
A directly exposed reverse proxy could provide ingress without a tunnel connector. It would also create a public origin route whose exposure, certificates, and edge bypass policy would need to be managed explicitly.
A managed load balancer or application platform could provide another ingress boundary. The initial system does not require the additional topology or a move of its application runtime to adopt that approach.
Consequences
The deployment has one intended public application route, with a separate internal proxy boundary. Container isolation and the host firewall still matter: Tunnel does not make unrelated listeners or published container services private.
Cloudflare availability, account security, DNS configuration, and connector credentials become part of the operational dependency chain. A connected tunnel does not prove that the web server or API is healthy. Verification must cover the public application response and its path to the origin.
The connector is also a trusted component. Its credential must stay outside the repository, and its runtime should receive only the credential it needs. Origin access controls do not replace application authentication or input validation.
Revisit when
Reassess this choice if ingress requirements cannot be met by Tunnel, its availability or account dependency becomes unacceptable, or an alternative provides a demonstrably better operational fit. Any replacement must preserve explicit origin exposure and visitor-identity trust boundaries.