Skip to content

Custom Domain & HTTPS

CompassDocs ships a ready-to-use Caddy reverse-proxy stack that serves the app on your own domain with TLS. You configure everything — the domain and the certificate mode — from the web UI: right in the setup wizard on a fresh install, or any time under Settings → Domain & HTTPS. CompassDocs pushes the configuration to the proxy at runtime, so there are no config files to edit and no restarts.

  • A domain (or subdomain) whose DNS A/AAAA record points at your server.
  • Ports 80 and 443 reachable from the internet (for Let’s Encrypt).
  • The deploy/docker-compose.tls.yml and deploy/Caddyfile files (included in the repo).

You only need POSTGRES_PASSWORD in your .env — the domain is set later in the UI.

Terminal window
docker compose -f docker-compose.tls.yml up -d

This runs the app behind Caddy. Until you set a domain, the app is served over plain HTTP so you can reach it and finish setup.

Open the app, sign in as an admin, and go to Settings → Domain & HTTPS:

  1. Enter your domain (e.g. docs.example.com).
  2. Choose an HTTPS mode (see below).
  3. Click Save & apply.

The page shows whether the reverse proxy is connected, and applies your choice live. Open https://your-domain — Caddy obtains the certificate on first request. The app itself is not exposed on the host; all traffic flows through Caddy on 80/443.

From 1.20.29 the domain is checked first: the proxy switches to it only once the name reaches this server, so a domain whose DNS isn’t visible yet can’t take away the address you’re using.

Before 1.20.29, saving a domain switched the proxy to serve that name and nothing else, straight away. If the name didn’t reach the server yet (DNS not visible, a typo, a closed port), the domain didn’t work and the address you had been using stopped answering too, so you were locked out of the settings that could undo it.

From 1.20.29, when you save a new domain (or a new HTTPS mode for it) in Settings → Domain & HTTPS or in the setup wizard, CompassDocs checks it first:

  1. It looks the name up in DNS (A and AAAA records, following a CNAME) and keeps the answer.
  2. It proves the name reaches this server: the app makes a short-lived random token, asks http://<domain>/.well-known/compassdocs-domain-check/<token> at the address DNS gave, and expects back an answer only this installation can compute from the token and the name it was asked for. The request goes through the proxy as it is configured now, which serves that path on any name over plain HTTP. It gives up after about 8 seconds.

If it fails, nothing is switched: the proxy keeps serving the current address, links in email keep using it, and the domain waits under the field with the reason and the DNS answer. The setup wizard opens Settings → Domain & HTTPS when its domain is waiting.

If it passes, the proxy is switched to serve the domain, and then CompassDocs makes sure HTTPS works before it counts the domain as live:

  1. For up to 2 minutes (while Caddy gets the certificate) it asks the domain over HTTPS, at the address the check proved. The address you are using keeps working meanwhile; the page shows Switching to docs.example.com: checking HTTPS, and the setup wizard waits on Switching to docs.example.com….
  2. When HTTPS answers, the domain is saved, links in email start using it, and plain HTTP on any other name, an IP address included, redirects to https://<your domain>. The setup wizard then opens the domain (sign in again there).
  3. If HTTPS never answers, the proxy goes back to the previous address and the domain waits again, with the reason (port 443 closed, or no certificate). Its automatic re-checks stop, so they don’t keep asking Let’s Encrypt and run into its rate limits: fix the cause and press Check again.

A certificate pasted under Bring your own certificate for a domain that waits is kept with that domain and only replaces the current certificate when the new domain goes live.

With Plain HTTP there is nothing to verify on port 443: the domain is live once the check passes.

The check runs only when CompassDocs manages the bundled proxy (the HTTPS compose stack). Saving the same domain and mode again, clearing the domain, or changing only the email or certificate re-applies without a check.

Message What it means What to do
docs.example.com doesn’t exist in DNS yet (no record found). DNS has no record for the name at all. Add an A record (or a CNAME) for it. A new record can take a few minutes to an hour to be visible.
docs.example.com points at x (a CNAME record), which doesn’t exist in DNS yet The name is a CNAME for a name that doesn’t exist. Fix the CNAME’s target.
docs.example.com is in DNS but has no A or AAAA record yet The name exists (it may have other records) but points at no server. Add an A record for the server’s public IP.
Couldn’t look up docs.example.com: the DNS server didn’t answer The DNS lookup itself failed. Try again in a few minutes; it re-checks on its own.
docs.example.com points at 1.2.3.4; this server didn’t answer there. Something answered at that address, but not this server: an old IP, another server, a parking page. Point the record at this server’s public IP.
Couldn’t reach docs.example.com on port 80 (timed out at 1.2.3.4): check that ports 80 and 443 are open. Nothing answered on port 80 at that address. Open ports 80 and 443 in the firewall or cloud network rules (on Azure, the VM’s network security group). If they are open and the server sits behind a router or firewall that can’t send it back to its own public address (no NAT hairpinning), the check can’t succeed from inside: use Use it anyway.
Couldn’t reach docs.example.com on port 80 (connection refused at 1.2.3.4) That machine refused port 80. Check that 1.2.3.4 is this server and that the HTTPS stack is running.
Cloudflare’s proxy is on for docs.example.com (orange cloud): turn it off until the certificate is issued. The name answers from Cloudflare’s network, and the check didn’t come back through it. In Cloudflare’s DNS settings, set the record to DNS only (gray cloud), save again, and turn the proxy back on once HTTPS works.
docs.example.com points at 10.0.0.5, a private address. Let’s Encrypt has to reach docs.example.com from the internet Automatic HTTPS was chosen for a name that points at a private address. Point the name at the public IP, or choose Self-signed for a name used only on your network.
docs.example.com points at 127.0.0.1, a loopback or link-local address The record points at an address that can never be this server from outside. Fix the record.
docs.example.com reaches this server, but the proxy didn’t take the new configuration The check passed, Caddy refused the configuration, nothing changed. Check that the proxy is running (docker compose logs caddy) and press Check again.
Port 443 didn’t answer for docs.example.com at 1.2.3.4 after the switch Port 80 works, port 443 doesn’t, so the switch was undone. Open port 443, then Check again.
Let’s Encrypt couldn’t issue a certificate for docs.example.com within 2 minutes No valid certificate in time, so the switch was undone. docker compose logs caddy says why (often a CAA record, a rate limit, or IPv6 pointing elsewhere); fix it, then Check again.
Couldn’t run the check for docs.example.com: … The app couldn’t read its master key. See The master key.

With Self-signed, Bring your own certificate or Plain HTTP, a private address is fine and is checked like any other.

While a domain waits, CompassDocs checks it again every 5 minutes for 24 hours on its own. When a check passes, it is applied, and every administrator gets a bell notice (Custom domain live) that the domain is live. Nothing else changes in the meantime.

Check again runs the check now. It also starts another 24 hours of automatic checks, so use it after the automatic checks have stopped. The third button, Keep and the current address (such as Keep docs.old.example.com), discards the waiting domain.

Some setups are invisible to the check: a load balancer or another proxy in front of this server, DNS that answers differently inside your network (split DNS), or a network that can’t reach its own public address. For those, Use it anyway switches to the domain without the check, after a warning: if the domain doesn’t reach this server, it won’t work and the current address stops answering (the fallback addresses keep working). The API sends force: true with the save.

Every outcome is in the audit log: Custom domain didn’t pass its check (with the reason), Switched to a custom domain, Went back from a custom domain whose HTTPS didn’t answer and Switched to a custom domain without its check.

From 1.20.29, once a custom domain is applied, the proxy keeps serving these addresses too, each as its own site, so there is always a way back in:

  • the names in COMPASSDOCS_FALLBACK_HOSTS (comma-separated) in the server’s .env. The Azure template writes the VM’s <label>.<region>.cloudapp.azure.com there;
  • the address you were browsing on when you saved a domain, when it’s a DNS name (not an IP address or localhost) other than the new domain. CompassDocs remembers up to five. Remove asks first, and you can’t remove the address you’re using right now: open CompassDocs at another address to do that.

Each is served like the domain: over HTTPS, with plain HTTP redirecting to HTTPS on the same name; with Plain HTTP it is HTTP only. The certificate:

  • a name from COMPASSDOCS_FALLBACK_HOSTS gets Let’s Encrypt with Automatic HTTPS and Bring your own certificate (whose certificate only covers your domain);
  • a remembered name gets Let’s Encrypt only if it passed the same reachability check when it was remembered; otherwise (an intranet name, split DNS) the internal CA, so the browser warns but you get in;
  • with Self-signed, every fallback uses the internal CA.

They are listed on Settings → Domain & HTTPS under Also reachable at. Links in email always use the custom domain, never a fallback address.

To add one to an existing install, put it in .env and recreate the app:

Terminal window
echo 'COMPASSDOCS_FALLBACK_HOSTS=myvm.eastus.cloudapp.azure.com' >> .env
docker compose up -d

The compose file must pass the variable to the app: the HTTPS compose files do from 1.20.29. An older copy of docker-compose.yml doesn’t; re-run the install script (it fetches the current file and keeps your .env), or add COMPASSDOCS_FALLBACK_HOSTS: ${COMPASSDOCS_FALLBACK_HOSTS:-} under the app service’s environment.

From 1.20.27 every link CompassDocs puts in an email is built from the workspace address, and only from it:

  1. the custom domain under Settings → Domain & HTTPS, as https://<domain>; or
  2. when no custom domain is set, COMPASSDOCS_BASE_URL in the server’s environment, such as https://docs.example.com or an intranet address like http://intranet:3000. Use it when your own proxy serves CompassDocs and you don’t set the domain here.

That covers desk and portal mail (new tickets, replies, SLA warnings, surveys, portal sign-in links and notices), document mail (comments and @mentions, change requests, read confirmations, review reminders), training, announcements, newsletters and status notices, and the chat and webhook posts that carry the same links. A link is never built from the address a request happened to arrive at, so nobody can send a request with a made-up host and have a genuine CompassDocs email point at their own server. Before 1.20.27 several of these followed the request’s host when no domain was set.

With no workspace address, mail links are relative, so they don’t work from an email client, and the customer portal sends no sign-in links at all. Desk admins are told:

  • in a strip under the desk’s top bar (“Desk emails have no working links.”), which each admin can dismiss for their browser;
  • as the first step of the desk’s setup checklist, Workspace address;
  • on Desk settings → Email and Customer portal, where the notice is red while the portal is on.

Each links to Settings → Domain & HTTPS for whoever can open it. SCIM provisioning with Microsoft needs the workspace address too.

Mode When to use
Automatic HTTPS (Let’s Encrypt) Public domain. Free certificate, auto-renewed. Optionally add a contact email for renewal notices.
Self-signed (internal CA) LAN or testing. Browsers show a warning unless you trust Caddy’s local CA.
Bring your own certificate You already have a certificate — paste the PEM certificate (with any chain) and private key. You handle renewals.
Plain HTTP A load balancer or Cloudflare already terminates HTTPS in front of this server.

The database is the source of truth: your settings are re-applied automatically whenever the app or the proxy restarts.

The bundled Caddy container exposes its admin API only on the private Docker network (never on the host). CompassDocs translates your choices into a Caddy configuration and posts it to that API, so changes take effect without a restart. Bring-your-own certificates are stored by the app and written to a volume the proxy reads.

  • Secure cookies work out of the box — the browser’s connection to Caddy is HTTPS and the app runs in production mode.
  • Already behind another proxy or load balancer? Either choose Plain HTTP here, or skip Caddy entirely and point your proxy at the app’s port from the plain docker-compose.yml. With your own proxy on the same host, set COMPASSDOCS_BIND=127.0.0.1 so only the proxy can reach port 3000, and set the domain here or COMPASSDOCS_BASE_URL so mail links work. See Keep port 3000 private.

If you terminate HTTPS with your own reverse proxy instead of the bundled Caddy stack, your proxy must forward the original scheme and host to CompassDocs. The app builds some absolute URLs, such as SCIM endpoints and especially the MCP connector’s OAuth discovery, from these headers. A proxy that terminates HTTPS but forwards the request to the app as plain http without X-Forwarded-Proto makes the app believe it’s running over HTTP, so it advertises http:// URLs that OAuth clients reject.

Run the app from the plain docker-compose.yml with COMPASSDOCS_BIND=127.0.0.1 in .env (1.20.27), so port 3000 is published on the loopback address only and nobody can reach the app without going through your proxy (see Keep port 3000 private). Set your domain under Settings → Domain & HTTPS or in COMPASSDOCS_BASE_URL, so links in mail use it (see The workspace address).

A short set of forwarding headers is all you need. For nginx, put them in the proxied location block:

location / {
proxy_pass http://127.0.0.1:3000; # your app's host:port
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme; # critical: resolves to "https"
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}

That’s the whole requirement — CompassDocs (including the MCP endpoint) speaks ordinary request/response HTTP, so you don’t need WebSocket Upgrade headers, proxy_http_version 1.1, or extended proxy_read_timeout values. If your proxy already sends those for other apps they do no harm, but they aren’t required here.

If a TLS-terminating layer sits in front of your nginx (Cloudflare’s proxy in Flexible mode, or an outer load balancer speaking plain HTTP to nginx), then $scheme at nginx is http and the forwarded value will be wrong. Either set Cloudflare’s SSL/TLS mode to Full (strict) so it connects to your origin over HTTPS, or hardcode proxy_set_header X-Forwarded-Proto https; on that host (safe when it’s only ever served publicly over HTTPS).

Verify from outside your network:

Terminal window
curl https://your-domain/.well-known/oauth-authorization-server

Every URL in the JSON should read https://your-domain/….