Cambium

Documentation

Cambium Server

Proxies and Networking

A Cambium server serves TLS itself, with its own certificate, and the desktop app checks it by fingerprint. That is all most studios need. Put the server behind a reverse proxy when you want a certificate from a public authority (so nobody compares fingerprints), several servers on one machine, or a normal HTTPS address on port 443.

Settings

These go in cambium.env beside compose.yml, one per line, and take effect after docker compose up -d --force-recreate.

SettingDefaultWhat it does
CAMBIUM_PORT8666The port the server listens on.
CAMBIUM_DISABLE_TLSfalseServes plain HTTP, for a proxy that does TLS in front of it.
CAMBIUM_BIND_ADDRESSeverywhere with TLS, 127.0.0.1 withoutThe address the server listens on.
CAMBIUM_TRUSTED_PROXIESemptyAddresses whose X-Forwarded-For header is believed, comma-separated.
CAMBIUM_MAX_UPLOAD_BYTES0 (no cap)The largest file a submit may hold.

Never serve plain HTTP to the open internet. Without TLS, the server listens only on 127.0.0.1 unless you name another address, and it warns at start when it serves plaintext elsewhere with no proxy named.

Behind a proxy on the same machine

With Docker, the proxy reaches the container through Docker's network, not through loopback. Leave compose.yml as it is and put a compose.override.yml beside it, which Compose reads on its own:

services:
  cambium:
    ports: !override
      - "127.0.0.1:8666:8666"
    environment:
      CAMBIUM_DISABLE_TLS: "true"
      CAMBIUM_BIND_ADDRESS: "0.0.0.0"
      CAMBIUM_TRUSTED_PROXIES: "172.30.66.1"
networks:
  default:
    ipam:
      config:
        - subnet: 172.30.66.0/24
          gateway: 172.30.66.1
  • The port is published on loopback only, so the proxy is the only way in. Docker's published ports go around the host firewall, so this matters.
  • TLS is off, because the proxy holds the certificate. The server listens on every address inside the container, since the container's own loopback can't be reached from outside it.
  • The proxy's connections arrive from the network's gateway, which is pinned so it can be named as trusted. Any unused private subnet will do.

Then point the proxy at 127.0.0.1:8666 and run docker compose up -d.

Several servers, one machine

A Cambium server owns a port, and serves one studio. A reverse proxy lets several share one address and one port, each reached by its own hostname: the name travels in the TLS handshake and again in the HTTP Host header, so the proxy can route on it.

                                    ┌─► 127.0.0.1:9001   organization1
client ──► 1.2.3.4:443 ─► proxy ────┼─► 127.0.0.1:9002   organization2
                                    └─► 127.0.0.1:9003   organization3

Give each server a folder of its own, its own published port in its override, and its own subnet. This needs a domain name: a bare IP address gives the proxy nothing to route on.

Caddy configuration

Caddy needs almost nothing: it sets the forwarding headers itself, keeps a pool of connections to the server, has no body-size limit to raise, and obtains certificates automatically.

gameteam.example.com {
    reverse_proxy 127.0.0.1:9001
}

filmteam.example.com {
    reverse_proxy 127.0.0.1:9002
}

Nginx configuration

Repeat the upstream and server pair for each Cambium server sharing the proxy, changing the name, the certificate and the port.

upstream cambium_gameteam {
    server 127.0.0.1:9001;
    keepalive 16;
}

server {
    listen 443 ssl;
    server_name gameteam.example.com;

    ssl_certificate     /etc/letsencrypt/live/gameteam.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/gameteam.example.com/privkey.pem;

    client_max_body_size 128m;

    location / {
        proxy_pass http://cambium_gameteam;
        proxy_http_version 1.1;
        proxy_set_header Connection "";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 120s;
    }
}
LineWhy it matters
client_max_body_size 128mnginx refuses anything over 1 MB by default, before Cambium sees it. The app sends files in pieces of at most about 72 MB, whatever the file's size, so 128 MB leaves room.
keepalive + proxy_http_version 1.1Without these, nginx opens a new connection to Cambium for every request. Cambium is built around keeping connections open.
X-Forwarded-ForHow Cambium learns who the real client is. Without it every user looks like the proxy (see below).

The app keeps one live connection open for updates. The server tells nginx not to buffer it, and sends something often enough that the 120-second read timeout never ends it.

Telling Cambium about your proxy

Behind a proxy every request arrives from the proxy, so without being told otherwise Cambium sees one client where you have twenty. That matters most for sign-in: after repeated wrong passwords from one address, Cambium makes that address wait, and if every user shares the proxy's address, one person mistyping their password makes the whole team wait.

CAMBIUM_TRUSTED_PROXIES fixes that. List your proxy, and Cambium reads the real client address from the X-Forwarded-For header it sets.

Leave it empty on a server with no proxy. Cambium then ignores the header entirely, as it should: otherwise anyone could set it themselves.

Checking it works

From a machine that is not the server:

  1. curl https://gameteam.example.com/api/server should return JSON naming that server. If two hostnames return the same name, the proxy is routing both to one server.
  2. Connect the desktop app to the hostname with no port. It should not ask you to compare a fingerprint, since a certificate from a public authority is accepted automatically.
  3. Submit a file comfortably larger than a megabyte. A failure here is almost always the proxy's body limit rather than Cambium.
  4. Get one account's password wrong several times, then sign in correctly as a different account from a different machine. The second sign-in should work. If it is made to wait, CAMBIUM_TRUSTED_PROXIES is not set and everyone shares one address.

When something is wrong

What you seeUsually means
The proxy answers 502The server is listening on the container's loopback. Set CAMBIUM_BIND_ADDRESS=0.0.0.0 with TLS off.
Submits fail on larger files, smaller ones workThe proxy's request body limit. On nginx raise client_max_body_size.
One person's bad password makes everyone waitCAMBIUM_TRUSTED_PROXIES is unset or wrong, so every user shares the proxy's address.
Every hostname reaches the same serverThe proxy is not routing on Host, or both blocks point at one port.
Other people's changes take minutes to show upThe proxy is buffering the live connection. Turn buffering off for it.
The server will not start: the port is in useSomething else, often another Cambium server, already holds the port.