Back to articles
2026-02-20

OpenClaw Cloudflare Tunnel Production Setup on Hetzner: DNS, Origin Certs, and Safe Rollback

A practical production pattern for OpenClaw behind Cloudflare Tunnel on Hetzner: trust-separated routes, fail-closed defaults, layered auth, and rollback-first operations.

Want this set up for you?
Basic Setup is £249 (24–48h). Email alex@clawsetup.co.uk.

Abstract: Cloudflare Tunnel can improve OpenClaw production safety when routes, auth, and rollback operations are configured and validated correctly. This guide explains a practical SetupClaw pattern for Hetzner: route separation by trust level, explicit DNS design, origin trust handling, fail-closed defaults, and rollback-first operations. The aim is a setup that is secure to run and predictable to recover.

Most tunnel incidents are not caused by Cloudflare being unreliable. They come from unclear boundaries. Teams publish one broad route, mix privileged UI access with webhook-like ingress, and then struggle to explain what is exposed and why.

A production SetupClaw approach starts from the opposite assumption. Keep the OpenClaw control plane private-first. Expose only what must be exposed. Document every route as an operational decision, not a convenience setting.

That sounds stricter, but it reduces both security risk and recovery time.

Start with DNS design before tunnel commands

DNS is not a final polish step. It is part of your security model.

Define explicit hostnames per surface. For example, use one hostname for high-trust operator access (ops.example.com) and a separate one for narrowly scoped ingress (bot.example.com). Avoid catch-all records. They look tidy until you need to debug or roll back under pressure.

Also document ownership and TTL expectations in your runbook. Rollback speed depends as much on DNS discipline as on tunnel configuration.

Separate routes by trust level

The strongest control in this architecture is route separation.

Privileged Gateway UI and websocket access should have tighter policy than webhook-like ingress. They should not share one permissive rule. If they do, blast radius expands and incident triage gets harder because traffic classes are mixed.

A practical rule is simple: if a route can trigger high-impact operator actions, treat it as high-trust and protect it accordingly.

Use fail-closed defaults

Production tunnel config should be explicit-allow, default-deny.

Only required endpoints should be reachable. Unspecified paths should fail closed. This protects you from accidental exposure when config drifts or when someone adds a route in haste.

Fail-closed behaviour is one of the most useful protections you can add with very little ongoing cost.

Cloudflare transport does not replace OpenClaw auth

This is a common misunderstanding. A secure tunnel is transport control. It is not application authorisation.

OpenClaw auth controls still matter: Gateway auth posture, Telegram allowlists, mention-gating, and route-level policy. If you relax those because “traffic is behind Cloudflare,” you are trading one control layer for another.

You want both layers active at the same time.

Treat origin trust and cert lifecycle as operations, not setup trivia

Origin trust configuration should be intentional and documented. Whether you use origin certs or another trust pattern, capture issuance, renewal, and rotation steps in the handoff runbook.

Record cert/origin trust expiry dates and include a monthly review check so renewals are proactive, not incident-driven.

Teams often skip this because everything works on day one. Then expiry or trust drift appears later and forces rushed fallbacks. Production readiness means handling cert lifecycle before the first expiry event.

Keep Hetzner host posture aligned with tunnel architecture

Tunnel convenience should not lead to broad host exposure.

Keep local firewall and service supervision aligned with private-first design. Avoid opening broad inbound ports “temporarily” to debug route issues. Those temporary openings are a common source of long-lived risk.

Your break-glass path should stay private, typically SSH or Tailscale patterns, so recovery does not require weakening network boundaries.

Verification checklist before go-live

Before declaring the setup complete, run a structured validation:

  • DNS resolves expected hostnames correctly
  • Tunnel service reports healthy status
  • Expected paths are reachable
  • Unexpected paths are denied
  • OpenClaw auth remains enforced
  • Telegram control flows still behave under least-privilege policy

Pass criteria should be explicit: expected routes return authorized success paths, unexpected paths are denied, and auth challenge still applies where required.

If these are not all true, go-live is premature.

Rollback is a first-class production feature

Rollback should be written before rollout.

A practical rollback plan includes immediate private access method, route disable sequence, DNS rollback order, and command-level verification after rollback. Keep it short enough for incident use.

Without this, teams improvise under outage pressure and often extend downtime with partial reversions.

Cron and tunnel incidents should be diagnosed separately

Tunnel failures can affect external ingress and delivery paths. They do not automatically mean cron is unhealthy.

Cron runs inside the Gateway process, so post-incident recovery should include a scheduler smoke test, but you should not assume scheduler failure when edge routing is the real issue.

Separate diagnosis avoids full-stack panic and reduces unnecessary restarts.

Use PR-reviewed workflows for tunnel and DNS changes

Tunnel and DNS edits are high-impact infrastructure changes. Treat them like code.

PR-reviewed config changes reduce manual error, preserve audit history, and make rollback easier because exact deltas are known. This is where PR-only discipline helps operations, not just development.

Practical implementation steps

Step one: define route inventory and trust class

List each exposed hostname/path, intended audience, auth policy, and owner.

Step two: implement explicit DNS records

Create only required records, with documented TTL and rollback notes.

Step three: apply tunnel rules with default deny

Allow only required endpoints and confirm unspecified paths fail closed.

Step four: validate auth and channel policy

Verify Gateway auth and Telegram least-privilege controls still gate behaviour.

Step five: run go-live verification suite

Test DNS, tunnel health, path allow/deny behaviour, and channel continuity.

Step six: test rollback before production change windows close

Run a controlled rollback simulation using private break-glass access and verify full recovery.

A Cloudflare Tunnel setup done this way gives SetupClaw customers what they actually need in production: clear exposure boundaries, safer change workflows, and faster recovery when network or config drift appears.

Want this set up for you?
Basic Setup is £249 (24–48h). Email alex@clawsetup.co.uk.