On this page
The Host header
The proxy must pass the visitor's Host header on unchanged: the server decides from it what to
answer. It serves the app, the API, MCP and attachments when Host is APP_ORIGIN's host name,
localhost, or an IP address (the shipped health check calls http://127.0.0.1:8080/, and Caddy asks
its certificate question on 127.0.0.1), and, with HELP_CENTER_DOMAIN, on each workspace's own host
<slug>.<HELP_CENTER_DOMAIN> for that workspace only (workspace host names).
A custom domain serves only its help center, and any other name gets
the help center's 404, never the app. A name the server does not own therefore never shows the
sign-in page, even if its DNS still points at the proxy.
- Caddy keeps
Hostby default. - nginx sends the upstream's name unless told otherwise; add
proxy_set_header Host $host;to everylocationthat proxies to Colliedesk. Without it, aproxy_pass http://colliedesk:8080;sendsHost: colliedesk:8080, and every request gets404. - Another proxy or load balancer: forward the original
Host, not the address of the upstream.
Health checks
Two paths answer on every host name the server serves (the app, each help center, the operator
console), whatever the Host header says. Both answer JSON, are never cached, and accept GET and
HEAD only.
| Path | Answers 200 when |
Use it for |
|---|---|---|
/livez |
the process answers HTTP; it checks nothing else | restarting a stuck process |
/readyz |
the database answers and holds every migration this binary needs | a load balancer, an uptime monitor, a deploy that waits for the new server |
/readyz answers 503 when a check fails, with a body such as
{"ready":false,"checks":{"postgres":false,"migrations":true}}. The server log says why the check
failed; the body never does. Each request runs every check at once and takes at most 2 seconds.
Point an uptime monitor at /readyz and expect 200, or look for "ready":true in the body. Do not
point it at a page: the web app answers any path with 200, so a page check stays green while the
database is down. Do not point /livez at a restart policy that also restarts on a database outage:
a restart does not bring the database back.
Trusted proxies
Behind a reverse proxy, Colliedesk must know the proxy to read the visitor's address from
X-Forwarded-For. Rate limits, for example those of the web form, count per
visitor address.
The server trusts no proxy until trusted_proxies names one. The installer sets it to loopback and
the Docker bridge range (127.0.0.0/8,::1/128,172.16.0.0/12), which fits a proxy on the same host, as its
compose file did before settings moved into the database. For another setup, set it to your proxy's
addresses or ranges, comma separated:
docker compose exec server /app/collie config set trusted_proxies=10.0.0.5,10.1.0.0/16 --yes
With no trusted proxy the server logs a warning at startup, and behind a proxy every visitor counts as
the proxy and shares one limit. collie config history and collie config restore <version> bring an
earlier value back; collie config reset trusted_proxies trusts no proxy again.
In the operator console (Security & network) a change of trusted proxies is a trial: the review shows what your own address would read as, and the change reverts by itself after 10 minutes unless you confirm it from the console (trial changes).
Warning: do not publish the server port on 0.0.0.0 (or any public address) without a proxy
in front while the installer's value is set. A client inside a trusted range, or one that
reaches the server directly through Docker's bridge, could then send a fake X-Forwarded-For and
pick its own address for the limits. The shipped files publish on 127.0.0.1 only. If you
expose the port directly, run collie config reset trusted_proxies.
Large uploads
Knowledge base videos go up in parts of at most 8 MiB, each one request. Caddy takes them as they
are. nginx refuses a body over 1 MB by default, so raise it for the API:
client_max_body_size 16m;. A part must arrive within 120 seconds.
A video plays and seeks with HTTP ranges (Range, 206 Partial Content); keep them working through
the proxy, and do not compress video/* (Caddy's encode leaves video alone; with nginx, leave
video/mp4 and video/webm out of gzip_types).
A help center sends at most 4 videos at once to one reader's address and 64 in all (503 with
Retry-After beyond). Set trusted_proxies so the address is the reader's: behind a proxy that is
not trusted, every reader has the proxy's address and the whole site plays 4 videos at once. The 64
are a safety valve: a few addresses holding slow connections can still take them all. A help center
video never changes under its address (Cache-Control: public, immutable), so a caching proxy or
CDN in front of /help/*/media/ is what takes that load off the server.
Videos take disk room: the server refuses an upload when the disk has less than the video, the
uploads in progress and 1 GiB free. Back up ATTACHMENTS_DIR with the database; a backup and an
export grow with the videos.
The help center's AI chat
An AI chat answer streams line by line (application/x-ndjson) from
POST …/chat/turns on the help center's address. The server sends X-Accel-Buffering: no, which
nginx honours; if your nginx ignores it, turn buffering off for that path:
location ~ /chat/turns {
proxy_pass http://colliedesk:8080;
proxy_buffering off;
}
Caddy streams it as it is. Do not compress application/x-ndjson (a compressing proxy holds the lines
back). An answer takes up to 90 seconds; keep the proxy's read timeout above that. Set TRUSTED_PROXIES
so the chat's limit of 10 questions a minute per address counts readers, not the proxy.
Live chat holds requests open instead: GET <help center>/chat/live?wait=1
and GET /api/v1/live-chats?wait= answer within 25 seconds, as plain JSON, so they need no buffering
setting; keep the proxy's read timeout above 30 seconds. Over plain HTTP/1.1 each inbox tab with live
chat on holds one of the browser's six connections to the server; HTTPS with HTTP/2 multiplexes it.
Workspace host names
Without extra setup, everything runs on APP_ORIGIN, and each workspace's
help center is at APP_ORIGIN/help/<slug>. To give
each workspace its own host name instead, for example acme.example.com:
- Point a wildcard DNS record,
*.example.com, at the proxy. - Set
help_center.domain=example.com(collie config setor the operator console). Each workspace then has the host name<slug>.example.com, with the scheme and port ofAPP_ORIGIN. A slug that cannot be a host name (for examplewww,mail,adminorops) keeps everything onAPP_ORIGIN, and the operator console's own address is served before any workspace host:https://acme.example.com/runs the workspace's desk: the inbox, every page of the app, its API and MCP. The team works there every day.https://acme.example.com/helpis the workspace's help center.APP_ORIGIN/help/acmeredirects there (301), and so do the help center's addresses from before it moved under/help(https://acme.example.com/a/12-resetmoves tohttps://acme.example.com/help/a/12-reset).robots.txtstays at the root of the host.APP_ORIGINkeeps sign-up, "find your workspace" (sign in there, choose the workspace) and the fixed callback addresses of Google, Microsoft, GitHub and Polar. A browser signed in onAPP_ORIGINmoves to the same page on its workspace's host, signed in there by a one-time token that works once, for one minute, only on that host. A callback that arrives onAPP_ORIGINis sent, with its query, to the same callback on the host of the workspace that started it, which finishes it for the person signed in there.
- Give the proxy certificates for the host names. With Caddy, get each one on demand and let the
server say which names it serves; it answers
200for an existing workspace's host name, and404for everything else:
{
on_demand_tls {
ask http://127.0.0.1:8080/api/v1/public/help-center/tls-ask
}
}
*.example.com {
tls {
on_demand
}
reverse_proxy 127.0.0.1:8080
}
Sessions belong to a host. The session cookie has no Domain attribute, so a browser sends it
only to the host that set it. On a workspace host the server accepts only that workspace's sessions
and agent tokens: another workspace's session gets 401 and its cookie is cleared, and a write made
with the cookie must come from that host's own origin. Cloud sign-in on a workspace host signs in to
that workspace only, whatever the browser asks for.
Names that never become workspace hosts. A slug that cannot be a host name (a reserved name such as
www, mail, support or help-staging) keeps everything on APP_ORIGIN. APP_ORIGIN's own host is
never a workspace's, also when it is inside HELP_CENTER_DOMAIN (APP_ORIGIN=https://app.example.com
beside HELP_CENTER_DOMAIN=example.com) or is HELP_CENTER_DOMAIN itself
(APP_ORIGIN=https://staging.example.com beside HELP_CENTER_DOMAIN=staging.example.com, workspaces on
<slug>.staging.example.com). Give every one-label name that has its own DNS record under the domain a
reserved slug, or the explicit record would take a workspace's host.
Changing HELP_CENTER_DOMAIN changes every workspace's host name and every custom domain's CNAME
target (hc-<claim>.<HELP_CENTER_DOMAIN>). The server answers only the names of the current value.
Let's Encrypt issues at most 50 certificates per registered domain a week; a wildcard certificate
(DNS challenge) avoids that limit if you serve many workspaces. Keep APP_ORIGIN's own site block:
a more specific site wins over the wildcard.
Custom help center domains
A workspace can also serve its help center on a domain of its own, such as help.example.com
(custom domain). It works with or without
help_center.domain:
- With
help_center.domain, the owner points the name with aCNAMEto the target the card shows,hc-<claim>.<help_center.domain>, which also proves the workspace owns it. The target is random, made when the domain is set and kept until it is removed or replaced, and no workspace slug can take its shape; the wildcard record already covers it, so there is nothing to add for it. The workspace's own<slug>.<help_center.domain>proves nothing: a slug can be renamed and then taken by another workspace. The wildcard record ofhelp_center.domainmust beA/AAAArecords, not aCNAME: the check reads where the name'sCNAMEchain ends, and a wildcard that is itself aCNAMEmakes every chain end elsewhere. The owner can always use theTXTrecord instead. - Without it, the owner points the name at the server (the card shows a
CNAMEtoAPP_ORIGIN's host, or anA/AAAArecord whenAPP_ORIGINis an IP address) and proves ownership with theTXTrecord_help-center-verify.<name>.
The proxy must send every other host name to the server and get its certificate on demand. The
server answers the ask with 200 only for an active custom domain whose help center is on, or a
pending one whose DNS check passes at that moment (it then becomes active, so one DNS change is
enough). It runs at most 4 such checks at once and at most one per name every 30 seconds, asks DNS
only for names a workspace has claimed, and records a certificate in the database at most once an
hour per name; every other name gets 404. With Caddy, add a catch-all site after your other sites:
{
on_demand_tls {
ask http://127.0.0.1:8080/api/v1/public/help-center/tls-ask
}
}
desk.example.com {
reverse_proxy 127.0.0.1:8080
}
# Every other host name: custom help center domains. Caddy asks the server before it gets a certificate.
https:// {
tls {
on_demand
}
reverse_proxy 127.0.0.1:8080
}
The proxy must keep the Host header (the Host header): the server decides from it
which help center to show. On a custom domain the server answers only help center pages; the app, the
API and MCP stay on APP_ORIGIN. nginx cannot get certificates on demand: issue one per custom domain
yourself and add a server block for it.
A domain removed in Settings stops being served with the next request, on every server process:
each page reads the domain's row. Each process remembers for up to 30 seconds which host names are
custom domains and which workspace's address to give out, and forgets a name at once when a domain
write through that process changes it. With several server processes behind one proxy, a domain that
has just become active through one of them may therefore get the help center's 404 on another for
up to 30 seconds, and API answers there may give the previous address for as long. A host name the
server does not know costs one database lookup; each client address may cause at most 10 a minute
(the help center's busy page beyond), so set trusted_proxies or every visitor
shares the proxy's 10.
The server checks every active custom domain at start and then daily. A domain whose records no
check has found for 7 days goes back to pending: it stops serving, and its other addresses serve the
help center again. Another workspace whose records prove a host name while the active workspace's
records do not takes it over at once. Both show in Settings and in the API (pending_reason).
Was this page helpful?
Updated
This page is rendered from the repository. Spot a mistake? Open an issue or a pull request.