Behind Cloudflare
None of this is required: Loomkeep works the same with plain DNS. With your domain’s DNS on Cloudflare, its free plan adds a few layers worth having on an instance open to the internet. Each section stands alone.
Proxying the domain
Section titled “Proxying the domain”Proxied (orange cloud), Cloudflare hides your server’s IP address and absorbs attacks before they reach it. In Cloudflare’s dashboard:
-
SSL/TLS › Overview: mode Full (strict). Caddy already has a real certificate; Flexible would talk to your server in plain HTTP.
-
SSL/TLS › Edge Certificates: turn on Always Use HTTPS.
-
DNS: proxy every name the stack serves, not only the main one (
grafana.,errors.,auth.…). WebSockets go through on their own. -
Optionally, a cache rule for
/_app/immutable/*: the web app’s build files, whose names change with their content, can be cached at Cloudflare’s edge for good.
Then tell Loomkeep about it. Once proxied, every visitor reaches your server from a Cloudflare address, not their own. Left as is, the API counts sign-in attempts and requests per Cloudflare server: everyone routed through the same one shares the same limits (sign-ins start failing with “too many requests” at busy times, and one person hammering the login blocks the others), and the security log and “new device” emails show Cloudflare’s addresses.
Add the Cloudflare override after the HTTPS override,
in COMPOSE_FILE or on the command line:
docker compose -f docker-compose.yml -f docker-compose.prod.yml -f docker-compose.cloudflare.yml up -dCaddy then trusts Cloudflare’s published address ranges, and those only, to pass on the visitor’s address. A request that doesn’t come through Cloudflare is still judged on its own address, so no one can pretend to be someone else by sending the header themselves.
Cloudflare rarely changes its ranges; when it does, update
docker/cloudflare/cloudflare.global.caddy from
cloudflare.com/ips.
Keep your provider’s firewall limited to ports 22, 80 and 443, not only the
server’s own: Docker can open ports around ufw.
Turnstile on sign-up
Section titled “Turnstile on sign-up”Turnstile adds a mostly invisible challenge to the sign-up form, against bots creating accounts. It needs a Cloudflare account, but not the proxy.
-
In Cloudflare’s dashboard, Turnstile › Add widget: type Managed, with your instance’s domain.
-
Copy the site key to
PUBLIC_TURNSTILE_SITE_KEY(public, read by the browser) and the secret key toTURNSTILE_SECRET_KEY(private, read by the API). Restart.
Left empty, there is no challenge.
Cloudflare Access
Section titled “Cloudflare Access”Cloudflare Access asks for a login, through GitHub, Google or a one-time code, before a request reaches your server. It suits the optional services’ admin tools: Grafana and GlitchTip. Loomkeep itself stays outside, since its accounts have their own login.
Create one self-hosted application per name, with a policy allowing only you. Then make room for what must get through without a login:
| Name | Let through | Because |
|---|---|---|
flags.<DOMAIN> |
/api/client/* and /api/frontend/*, to everyone |
The API and every visitor’s browser read flags there, with tokens of their own. Blocked, every flag falls back to its default. |
grafana.<DOMAIN> |
/api/health, to your uptime monitor’s addresses |
Otherwise the monitor only sees Access’s login page, and reports Grafana up when it is down. |
errors.<DOMAIN> |
/api/<project-id>/envelope/, to everyone |
The browser and API send error reports there. Keep the GlitchTip dashboard and management API protected. |
stats.<DOMAIN> |
Don’t put Umami behind Access | Visitors’ browsers load its script and send it their visits. |
In Access, “let through” is a second application on that path, with a Bypass policy. Keep each bypass to its path, and to the monitor’s published addresses for Grafana.
For GlitchTip, replace <project-id> with each project id from your DSNs
(for example /api/1/envelope/ and /api/2/envelope/). Create a separate
application for each ingestion path with Bypass → Everyone. Do not
bypass /api/*: that would also expose the management API. A redirect to
the Access login page prevents the SDK from delivering errors; allowing
that login domain in the app’s CSP does not solve it. The app’s CSP allows
your GlitchTip origin on its own, from PUBLIC_GLITCHTIP_WEB_DSN.