Cloudflare
This page is for an owner deciding between the two front doors, or one whose payment notices are not getting through. After it, you will know what Cloudflare can see when your site uses its tunnel, what to change so payment webhooks get past its bot protection, and when direct mode is the better choice.
Your site's front door is the way visitors on the internet reach your server. When you install, you choose one of two:
- Tunnel (the default): a Cloudflare tunnel. A small program on your server,
cloudflared, connects out to Cloudflare, and Cloudflare passes visitors in along that connection. Nothing on your server listens to the internet and you open no port on your router, so it works on a computer at home as well as on a rented server. A free Cloudflare account is enough, and your domain must use Cloudflare for its DNS. - Direct: visitors connect straight to your server's own public address, and your server makes its own certificates.
Putting your domain on Cloudflare, what the installer's Cloudflare sign-in does, and the account certificate you should revoke afterwards are all on Putting your domain on Cloudflare. Cloudflare's own explanation of tunnels is Cloudflare Tunnel.
Recommended: the tunnel, unless you do not want Cloudflare to see your site's traffic (next section), or your server already has a public address and you prefer to manage it yourself.
What Cloudflare can see
Visitors' browsers make their secure, padlocked connection (TLS, the "s" in https) to Cloudflare, not to your server. Cloudflare unlocks each request, then sends it down the tunnel to your server. So Cloudflare is able to see your site's traffic as it passes: the pages people open, what they type into forms, sign-ins, and the chat messages sent through the site. This is how Cloudflare's service works for every site that uses it, tunnel or not, and it is covered by Cloudflare's privacy policy.
Some things stay out of Cloudflare's view anyway:
- Card numbers. Stripe draws the card form and it sends card details straight to Stripe; PayPal's button goes straight to PayPal. Neither passes through your server or Cloudflare.
- Encrypted direct messages and rooms. In an encrypted direct message (every one started on the site) or a room with encryption switched on, the message is locked on the sender's device and only unlocked on the reader's. Cloudflare, like your own server, passes along only the locked version. See Encryption.
Inside your server, the request travels from cloudflared to the site without a second layer of encryption; it never leaves the machine. Your server trusts only cloudflared to say which visitor a request came from, so a visitor cannot pretend to be someone else to get past rate limits or bans.
If you would rather nobody between your visitors and your server could read the traffic, use direct mode.
Letting payment webhooks through
Payment services tell your site about each payment with a webhook: an automated message from their servers to yours. With the tunnel, every webhook passes through Cloudflare first, and Cloudflare's bot protection is designed to stop automated traffic. It can take a payment notice for an attack and block it. The payment still happens, but your site never hears about it: no alert, no Supporter perks, nothing on the support bar.
The addresses that receive webhooks:
| Service | Address | Page |
|---|---|---|
| Stripe | example.com/api/billing/webhook |
Card payments (Stripe) |
| PayPal | example.com/api/billing/paypal/webhook |
PayPal and Venmo |
| Ko-fi | api.example.com/webhook/kofi |
Ko-fi, Patreon and Streamlabs |
| Patreon | api.example.com/webhook/patreon |
Ko-fi, Patreon and Streamlabs |
Cloudflare's bot protection is known to block Stripe's webhooks in particular. What to do depends on your Cloudflare plan:
- Free plan: Bot Fight Mode. Cloudflare does not let any rule make an exception to Bot Fight Mode. If it is on and it blocks your webhooks, the only fix on the Free plan is to turn it off: Cloudflare dashboard → your domain → Security → Settings, filter by Bot traffic, and switch Bot fight mode off. Cloudflare says so in Bot Fight Mode.
- Pro plan and above: Super Bot Fight Mode. Here a skip rule works. Cloudflare dashboard → your domain → Security → WAF → Custom rules → Create rule. Set the field URI Path, operator equals, value
/api/billing/webhook; set the action to Skip; and tick every bot and security feature it offers, including Super Bot Fight Mode. Make one rule per address in the table above that is being blocked. Cloudflare's guide is Skip rules.
The Stripe step on the setup page (Behind Cloudflare: let Stripe through) and the Doctor's fix line give the same advice for each plan.
If you use Super Bot Fight Mode, Cloudflare also advises keeping Definitely automated set to Allow for sites behind a tunnel; otherwise the tunnel itself can fail.
Your site cannot see your Cloudflare settings, so the Doctor's row Stripe gets past Cloudflare's bot protection stays grey, as a reminder to check by hand. The reliable check is the provider's own webhook page: a delivery refused with 403 usually means Cloudflare stopped it before it reached your server.
Audio and video libraries
Cloudflare's terms do not allow using its free service mainly to serve large audio or video files. The rig page's short sound clips are fine. If a module on your install serves a library of songs or videos, the Doctor's row No audio or video library through the tunnel turns red in tunnel mode, and the fix is to switch that module off or use direct mode.
The direct alternative
In direct mode Cloudflare is not involved (unless you choose to use it yourself). Visitors connect straight to your server, and your server makes its own TLS certificates from Let's Encrypt, a free certificate authority, and renews them by itself.
Both front doors are tested end to end by the project. For direct mode that means a fresh public Ubuntu 24.04 server: installed in about two and a half minutes, certificates for all three names, setup finished from a phone, then an update to the next release through the release feed with its health check passing.
| Tunnel | Direct | |
|---|---|---|
| You need | A free Cloudflare account with your domain on it | A public IP address, with ports 80 and 443 reaching the server |
| Behind a home router | Works; the server only connects out | Only if you forward ports 80 and 443 to the server |
| Who can read the traffic in transit | Cloudflare | Nobody but your server |
| Certificates | Cloudflare's | Let's Encrypt, made by your server |
| DNS records | The installer creates them | You create three records first: A (or AAAA) records for example.com, api.example.com and matrix.example.com, pointing at the server |
| Bot protection on webhooks | Check it (above) | Not a concern unless you add a firewall that filters them |
For direct mode, create the three DNS records at whoever runs your domain's DNS before you run the installer. The installer checks that all three names resolve and stops with a message naming the one that does not.
When it goes wrong
| What you see | What it means | What to do |
|---|---|---|
| The Doctor's row Tunnel connected, or certificates valid is red and says the tunnel is not connected | cloudflared cannot reach Cloudflare, or the tunnel was deleted |
Run sudo blackbranch logs cloudflared on the server. A deleted or revoked tunnel needs the installer's tunnel step again; see Putting your domain on Cloudflare. |
| The Doctor's row The three names resolve is red | A DNS record is missing or points elsewhere | Tunnel mode: check the three records on Cloudflare's DNS page. Direct mode: add an A (or AAAA) record for each. |
| Your site loads but payments never show up | Bot protection is blocking webhooks | See Letting payment webhooks through. |
| Direct mode: the browser warns about the certificate | The server could not get or renew its Let's Encrypt certificate | Ports 80 and 443 must reach the server. Run sudo blackbranch logs caddy. |
| The installer stops at "does not resolve" | Direct mode, and a DNS record is missing or has not spread yet | Add the record, wait a few minutes, run the installer again. |
Moving to a new server keeps the same tunnel, because its credentials come back with the restore. See Moving to a new server.
Next: Running it