Running behind a reverse proxy
Turtle speaks plain HTTP. To give it an address of its own with HTTPS, such as https://turtle.example.org, put a reverse proxy in front of it, such as Caddy, nginx or Traefik, and let the proxy handle the certificate.
What the proxy must do
- Forward everything at the root of the host to Turtle, on port 4100 unless you set
TURTLE_PORT. Turtle is served at the root of its host, not under a path. - Pass on WebSocket connections. Pages are edited live over WebSockets at
/ws/. Without them, a Page shows Offline, retrying… and changes are not saved. - Accept large requests on
/api/, up toTURTLE_MAX_IMPORT_MB, so ZIPs can be uploaded for an import. See Settings. - Pass on the client's address in a header, such as
X-Forwarded-For.
What to set in Turtle
| Setting | Why |
|---|---|
TURTLE_PUBLIC_URL | The address people open in the browser. Turtle cannot work it out by itself. Without it, AI clients cannot sign in, and the Connect AI page tells the Workspace Admin what is missing. |
TURTLE_CLIENT_ADDRESS_HEADER | The header the proxy passes the client's address in, such as X-Forwarded-For. Turtle takes the last address in it, the one your proxy added. Behind more than one proxy, name the header the outermost one sets, such as CF-Connecting-IP behind Cloudflare. |
Without TURTLE_CLIENT_ADDRESS_HEADER, everyone behind the proxy counts as one client when Turtle counts failed sign-ins, so one person's mistakes can lock others out for 15 minutes. Leave it unset when there is no proxy, since anyone can send the header.
When Turtle and the proxy run on the same machine, keep TURTLE_HOST at 127.0.0.1 for the binary, so only the proxy reaches Turtle. With Docker, publish the port on the loopback address only, such as -p 127.0.0.1:4100:4100.