---
title: "Custom domain and HTTPS"
description: "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."
lang: "en"
version: "1.84.0"
url: "https://docs.calends.date/en/self-host/custom-domain/"
markdown_url: "https://docs.calends.date/en/self-host/custom-domain.md"
section: "Self-hosting"
llms_index: "https://docs.calends.date/llms.txt"
llms_full: "https://docs.calends.date/llms-full.txt"
agents_guide: "https://calends.date/AGENTS.md"
---

# 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.

- Canonical page: https://docs.calends.date/en/self-host/custom-domain/
- Markdown source: https://docs.calends.date/en/self-host/custom-domain.md
- Calends version: v1.84.0

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:

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

Then deploy again:

```bash
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](https://docs.calends.date/en/self-host/config.md).

## 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):

```text
calends.example.com {
  reverse_proxy 127.0.0.1:8787
}
```

**Nginx**:

```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.

---

## Related Pages & Global AI Discovery

To explore broader context beyond this page, fetch any of the Markdown or plain-text resources below directly:

### Same Section (Self-hosting)
- [Cloudflare Workers + D1](https://docs.calends.date/en/self-host/cloudflare.md)
- [Docker](https://docs.calends.date/en/self-host/docker.md)
- [Configuration](https://docs.calends.date/en/self-host/config.md)
- [Custom domain and HTTPS](https://docs.calends.date/en/self-host/custom-domain.md) *(current)*
- [Upgrading](https://docs.calends.date/en/self-host/upgrade.md)
- [Local development](https://docs.calends.date/en/self-host/development.md)
- [Translating](https://docs.calends.date/en/self-host/translate.md)

### Reading Order
- Previous: [Configuration](https://docs.calends.date/en/self-host/config.md)
- Next: [Upgrading](https://docs.calends.date/en/self-host/upgrade.md)

### Global Calends Resources
- Read-only Docs MCP Server (zero auth Streamable HTTP): https://docs.calends.date/mcp
- Complete Docs Index (all 37 topics with `.md` links): https://docs.calends.date/llms.txt
- Complete English Docs Bundle (single file): https://docs.calends.date/llms-full.txt
- Complete Simplified Chinese Docs Bundle: https://docs.calends.date/llms-zh.txt
- Docs AI Agent Guide: https://docs.calends.date/AGENTS.md
- Product Website Overview (Markdown): https://calends.date/en/index.md
- Product LLMs Index & Full Reference: https://calends.date/llms.txt | https://calends.date/llms-full.txt
- Deployment & MCP Agent Guide (AGENTS.md): https://calends.date/AGENTS.md
- FAQ & Calends vs Wallos Comparison (Markdown): https://calends.date/en/faq.md | https://calends.date/en/compare.md
- Complete Changelog (Markdown): https://calends.date/en/releases.md
