Domains and HTTPS
HTTPS for the manager, Cloudflare Tunnel and Cloudflare DNS.
HTTPS for the manager
Set KIPITINY_DOMAIN=kipitiny.example.com (DNS pointing at the server) and the
manager's Traefik routes that domain to the UI with a Let's Encrypt certificate,
like any app. In a container, the manager attaches itself to the proxy network,
so port 3000 no longer needs to be published: drop it from the compose file or
bind it to 127.0.0.1 for SSH-tunnel access. Run on the host, the manager is
reached through host.docker.internal, so it must listen on the Docker bridge
(the default :3000 does).
Path routes
By default an app gets its whole domain. With routes in its
x-kipitiny block, only the listed
path prefixes reach it, each over its own scheme and container port:
services:
server:
image: ghcr.io/example/server:1.4.0
expose: ["80"]
x-kipitiny:
domain: app.example.com
routes:
- paths: [/my.api.Service/]
scheme: h2c
- paths: [/api, /ws]
In the UI, the same rows are under Settings › Networking › Domain: path prefixes separated by spaces or commas, the scheme and an optional port.
- gRPC needs
scheme: h2c: Traefik then talks HTTP/2 to the container without TLS. Streams that stay open longer than a minute also needKIPITINY_TRAEFIK_READ_TIMEOUT=0: Traefik otherwise cuts them after 60 s. h2c paths go without the retry Traefik otherwise adds during rollouts, which would hold a bidirectional stream back: gRPC clients reconnect on their own. - WebSockets work on the default
httpscheme. - While the app is down, its paths show the maintenance page below.
One domain, several services
Services of the same project can share a domain: each one lists its paths in
routes, and at most one has no routes and takes every other path. Without
such a catch-all, other paths get a 404. Two services can't list the same
path, and a domain belongs to one project.
services:
dashboard:
image: ghcr.io/example/dashboard:2.1.0
expose: ["80"]
x-kipitiny:
domain: app.example.com # everything else
server:
image: ghcr.io/example/server:1.4.0
expose: ["80"]
ports: ["3478:3478/udp"]
x-kipitiny:
domain: app.example.com
routes:
- paths: [/my.api.Service/]
scheme: h2c
- paths: [/api, /ws]
- The domain has one DNS record. When any of its services publishes ports, the record points straight at the server, never through Cloudflare's proxy, for all of them. Behind a Cloudflare Tunnel that can't work, so a service with published ports can't share its domain with services serving HTTP there.
- Middlewares (basic auth, IP allowlist…) apply to each service's own paths. Analytics count a domain through one of its services.
- Previews give the services sharing a domain one preview domain too.
Maintenance page
When an app's domain has no replica to answer (stopped, crashed, or a deploy
whose replica never got ready), visitors get a plain page saying the app will
be back soon, with the project's name, instead of Traefik's bare 404 or 502.
It answers 503 with Retry-After, so search engines come back later instead
of indexing it, and uptime checks still see the app as down. Replies the app
sends itself, including its own 503s, pass through unchanged.
The page belongs to the project: every app of the project shows the same one. Change it in the project's Settings › Maintenance: a title and a message, or a whole HTML document of your own (up to 64 KiB; inline its styles and images, or load them from another site, since the app is down). Open the saved page shows it.
Maintenance mode in the same card sends every visitor of every app of the
project to the page while the replicas keep running, e.g. during a long
migration or manual work. IPs or ranges listed under Still reach the apps
get the apps as usual (through each app's access settings), to check them
before reopening. It applies within seconds and restarts nothing; agents turn
it on with the set_maintenance MCP tool, or call
PUT /api/projects/{id}/maintenance. It is not part of compose files, so git
projects set it there too.
The manager serves these pages through each server's Traefik: there is no
extra container. Remote servers fetch them from the manager's domain, so they
need KIPITINY_DOMAIN; without it their apps keep Traefik's own errors.
Cloudflare Tunnel (no open ports)
To keep ports 80/443 closed, let traffic come in through a Cloudflare Tunnel:
- In Cloudflare Zero Trust, create a tunnel (Networks → Tunnels, type cloudflared) and copy its token.
- Either connect Cloudflare in Settings (below), which adds each service's
hostname to the tunnel, or add public hostnames yourself:
example.comand*.example.com, both with service HTTPSkipitiny-traefik:443, and under TLS enable No TLS Verify and Match SNI to Host. Check that DNS has a proxied* CNAME <tunnel-id>.cfargotunnel.comrecord, and add it if the dashboard didn't. - Paste the token in Infrastructure › Servers › Network (globe button), or start
the manager with
KIPITINY_CLOUDFLARE_TUNNEL_TOKEN=<token>for its own server (withKIPITINY_DOMAIN), and publish no port in the compose file.
The manager then runs kipitiny-cloudflared next to Traefik, and Traefik
publishes no ports and requests no Let's Encrypt certificates: Cloudflare
serves the public certificate, and Traefik's own certificate only protects the
hop from cloudflared. Service domains need no per-app setup as long as they
match a hostname of the tunnel. Cloudflare's free certificate covers one level
of subdomain (app.example.com, not a.b.example.com).
Each server can have its own tunnel (one token per server; create one tunnel per server): the manager runs cloudflared on every server with a token, and those servers publish no ports. With Cloudflare connected, each app's hostname points at the tunnel of the server running it. Apps deployed before switching keep working, but redeploy them to drop their Let's Encrypt labels (Traefik logs a "nonexistent certificate resolver" error until then).
Cloudflare DNS
List your domains in Infrastructure › Domains & DNS and connect Cloudflare there with an API token (My Profile › API Tokens) allowed Zone › Zone › Read and Zone › DNS › Edit, plus Account › Cloudflare Tunnel › Edit with a tunnel. Connecting adds the token's zones to the list, so you don't type them in; a zone whose SSL/TLS mode is Full or Full (strict) comes in Proxied. For every service domain in one of the token's zones, the manager then keeps the DNS record in sync:
- an A record to the server's public IP (detected, or set under Infrastructure › Servers), proxied if the domain is marked Proxied;
- behind the tunnel, a proxied CNAME to it, and the tunnel's route to Traefik.
Records are synced seconds after a domain changes and every ten minutes; the
refresh button on the Cloudflare card (or the sync_dns MCP tool) syncs them
right away and detects public IPs again. Records are created, updated and
removed as services come and go; they carry
the comment managed by kipitiny, and records without it are never changed (a
service whose name already has one shows a DNS conflict). Certificates for these
domains come from Let's Encrypt through the Cloudflare DNS challenge, so they
work behind the proxy too; Traefik gets the token for that. Proxied domains
need the zone's SSL/TLS mode on Full (strict). Services deployed before
connecting keep their certificate settings until their next deploy.
Cloudflare's free certificate covers the zone and one level under it
(*.example.com): a proxied name deeper than that, like api.dev.example.com,
gets a TLS error at Cloudflare's edge (the browser shows a blank error page).
The service shows a DNS warning then: pick a single-level name
(api-dev.example.com), turn off Proxied for its domain, or order an
advanced certificate in Cloudflare. Behind a tunnel, records are always
proxied, so only the first and last options work.
DNS follows a domain change right away, but Traefik routes the new domain after the service's next deploy: until then the service shows in yellow, with a Deploy now button.
For local testing use a *.localhost domain and alternate ports, e.g.
KIPITINY_HTTP_PORT=8081 KIPITINY_HTTPS_PORT=8443, then
curl -k https://app.localhost:8443 (Traefik serves its default self-signed cert).