Domains and routing
Which hostname serves what, how the edge keeps public contracts intact, and how to run it under your own domain.
View options
One Caddy instance (infra/Caddyfile) fronts the whole platform. The split is deliberate: the marketing site must never be able to break the API, and customer-embedded URLs must never move.
| Host | Serves | Backed by |
|---|---|---|
chatwork.io, www.chatwork.io |
Marketing, pricing, agents, docs, blog and resources under /en and /ar; /llms.txt |
Static files built from apps/web |
chatwork.io/api/*, /mcp, /.well-known/mcp.json, /webhooks/*, /widget.js, /health, /static/portal/* |
Public API, MCP server, webhooks, widget | The bridge (same origin as the site, so the widget and the status strip need no CORS) |
app.chatwork.io |
Operator dashboard and the sign-in / sign-up page, each under /ar and /en (/en/login, /ar/signup, /en) |
The bridge |
api.chatwork.io |
The API without the site in front of it (for integrators who prefer a clean host) | The bridge |
chat.chatwork.io |
Inbox console and WebSocket (/cable) |
chatwork Rails |
Contracts that do not move
Customers embed https://chatwork.io/widget.js; MCP clients discover https://chatwork.io/mcp; chatwork’s agent bot posts to https://chatwork.io/webhooks/chatwoot?token=…. Those paths stay on the apex host forever. The Caddyfile routes them by path prefix before anything falls through to the static site.
Legacy portal paths on the apex (/saas, /inbox.html) redirect to app.chatwork.io with a 301.
Your own domain
Set PLATFORM_DOMAIN=example.com in infra/.env. Caddy serves example.com, www., app., api. and chat. and requests certificates for all five. Set DOT_PUBLIC_BASE_URL=https://example.com and CHATWOOT_PUBLIC_URL=https://chat.example.com so generated URLs (agent-bot webhook, widget origin, payment return page) match.
Behind Cloudflare
The production deployment of chatwork.io sits behind a Cloudflare Worker that proxies the same hostnames to the origin over TLS. Keep “Full (strict)” TLS and forward X-Forwarded-Host and the WebSocket upgrade for chat.; the bridge trusts X-Forwarded-* only from UVICORN_FORWARDED_ALLOW_IPS.
Languages
Every public page exists under /en and /ar. The apex root redirects by the browser’s Accept-Language (Arabic browsers to /ar, everyone else to /en); old unprefixed paths such as /docs/quickstart redirect to /en/docs/quickstart. On app., an unprefixed path uses DOT_DEFAULT_LOCALE (default ar) unless the browser saved a choice; /login and /signup on the apex redirect to app..