Behind a reverse proxy
Set --public-url to the address people actually use. It is what an app is told
to send its replies to, and having it configured means nothing has to be inferred
from a request. Invite and message links are built on it too, so a link copied by
someone looking at the workspace through localhost still works for everyone
else. Add --trust-proxy only when a proxy in front of this server
writes the X-Forwarded-* headers and nothing can reach the server directly:
anyone can send those headers, and without a proxy to vouch for them a forged one
would decide where an app's reply and its token went. With neither set, the server
uses the address the connection arrived on, which no header can change.
The browser client is sent already compressed. The build writes a Brotli and a
gzip copy of each script and stylesheet, and the server sends the one the browser
accepts, with Vary: Accept-Encoding. Files under /assets/ are named by their
content, so they are cached for a year (immutable); the page itself is
no-cache, so a new version is picked up on the next visit. A proxy needs no
compression of its own for these: let Accept-Encoding through and keep Vary.
The address must be a full http:// or https:// URL. A path is fine, for a
server published under one (https://example.com/chat), though clients reach a
server at its root, so links are then built on the address each person uses
instead. A username or password, a query or a #fragment is refused at startup,
since whatever is in the address is repeated in every URL handed to an app.
The server checks its settings before it starts and stops with a one-line reason
naming the flag: a port outside 0–65535, a malformed --public-url, a fraction
of a day for --retention-days, an unknown flag, a port already in use or one
this account may not bind, or a --host address the machine does not have.
While a workspace has no owner yet, creating the first account from the machine
running the server does not need the claim code. That applies to a command line
request or to the page this server itself served, not to any page that merely has
your browser post to localhost — those carry an Origin naming somewhere else and
are asked for the code like anyone else.