Custom domain and HTTPS

Put Calends on your own domain — a custom_domain route on Cloudflare, or a reverse proxy in front of Docker — and what to watch for with passkeys and links when changing domains.

On this page

Set up HTTPS on your own domain and update calendar links, MCP clients and sign-in credentials after moving.

  1. Choose a domain and configure the route or reverse proxy below for your deployment.
  2. Set SITE_URL to https://calends.example.com and redeploy or recreate the container.
  3. Sign in through the new domain and check HTTPS, passkeys, calendar links and MCP access.

Cloudflare

Add routes to wrangler.jsonc to attach the domain to the Worker as a custom_domain. The domain must already be on your Cloudflare account:

"routes": [{ "pattern": "calends.example.com", "custom_domain": true }],

Then deploy again:

Terminal window
npm run deploy

Cloudflare creates the DNS record and certificate for you. Adding a custom domain in the Worker’s dashboard settings does the same.

Also set SITE_URL in vars to the new domain; see Configuration.

Docker

Calends itself only speaks HTTP. Put it behind a reverse proxy for HTTPS. The installer starts only the local service; it does not configure domains or web servers.

Calends detects the visitor IP automatically: it reads X-Forwarded-For only for local, private or Cloudflare connections, choosing the first untrusted address from the right. Usually leave TRUST_PROXY unset. Caddy, Traefik and Cloudflare Tunnel work as they are. Nginx must append proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;, or a visitor can forge the IP used for login rate limiting.

Publish the port only to the proxy (-p 127.0.0.1:8787:8787); for systemd use HOST=127.0.0.1. If Calends is also reachable directly, use TRUST_PROXY=off: visitors on the same private network can forge this header, as can internet visitors when Docker presents connections as its gateway (Docker Desktop, rootless Docker and some IPv6 port mappings). For a CDN other than Cloudflare, add its address ranges with a comma-separated IP/CIDR list, for example TRUST_PROXY=192.0.2.0/24,198.51.100.7; otherwise all visitors share the CDN address.

Old numeric values such as 1 and 2 now mean automatic detection, not a hop count. Cloudflare deployments do not use this variable. Login rate limiting does not affect existing signed-in sessions.

Caddy (gets certificates automatically):

calends.example.com {
reverse_proxy 127.0.0.1:8787
}

Nginx:

server {
listen 443 ssl;
server_name calends.example.com;
# ssl_certificate / ssl_certificate_key ...
location / {
proxy_pass http://127.0.0.1:8787;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

The built-in assistant’s streaming responses carry an X-Accel-Buffering: no header, so Nginx doesn’t buffer them and replies appear as they’re written.

For use on your own machine or LAN only, you can open http://<IP>:8787 directly. Browsers only allow passkeys over HTTPS or on localhost, so via an IP you’ll sign in with your password.

When changing domains

  • Passkeys are tied to the domain and won’t work on the new one. Sign in with your password, then add new ones under Settings → Security.
  • Calendar feed and reminder links use your site address. If you set SITE_URL, change it; if not, open the app once on the new domain. Calendars you’ve already subscribed need the new link.
  • MCP clients need the new address; tokens stay the same.
  • Your data isn’t affected.

For Cloudflare deployments, OLD_HOSTS can list old hostnames (comma separated). Keep their Worker routes and set SITE_URL to the new address: old page requests redirect with HTTP 301, while API, MCP and ICS endpoints stay available. This variable is not forwarded by the Docker runtime.