Use your own reverse proxy
Replace the bundled Caddy with your own proxy while keeping Acclimate's HTTPS origins, private listeners and trusted proxy headers.
To replace the bundled Caddy with your own proxy, such as nginx or Traefik, it must do what Caddy does. No replacement proxy has been tested. Self-host Acclimate needs no proxy changes.
Match the bundled proxy
| Requirement | For both the console and the API hostname |
|---|---|
| TLS | Terminate TLS and redirect public HTTP to HTTPS. |
| Routing | Send the console hostname to console:3100 and the API hostname to service:3000, over plain HTTP. |
Host | Set the upstream Host to the fixed public host for that route. For the console, use the host from CONSOLE_ORIGIN, with the port if you use a nondefault HTTPS port. |
| Forwarding headers | Remove incoming Forwarded and all X-Forwarded-* headers. Set X-Forwarded-Proto to https, X-Forwarded-Host to the fixed public host and X-Forwarded-For to the peer IP address your proxy observed, without a client-supplied chain. |
| Request contents | Preserve paths and query strings, including /auth/callback, console cookies, the request Origin and the API Authorization header. |
| Body limit | Let API requests reach the service's 2 MiB limit. A proxy that enforces it returns its own 413 response. |
| Timeout | Set the upstream response timeout slightly above 30 seconds, so the service returns its own timeout response. |
| Private listeners | Do not expose either listener, either PostgreSQL database or the proxy's admin interface. |
The console rejects a request for any other host and ignores forwarding headers that a caller supplies. Register the exact public console origin plus /auth/callback with Keycloak.
Allow task imports
A proxy that applies 2 MiB or 30 seconds to task import rejects or cuts off larger imports.
| Host | Request | Body limit | Time allowed |
|---|---|---|---|
| API | POST /v1/workspaces/{workspaceId}/bundles/{bundleId}/learning/tasks/import | 64 MiB | 600 seconds |
| Console | POST /learning-import | 64 MiB | 610 seconds |
Keep Keycloak sign-in working
With the co-hosted Keycloak, your proxy also serves the Keycloak hostname.
- Forward only
/realms/acclimate,/realms/acclimate/*,/resources/*and/robots.txttokeycloak:8080, and answer every other path yourself, as the bundled configuration does with a 404. - Apply the same header rules with the Keycloak hostname.
- Keep
/admin, the master realm and the management listener private. The admin console is on Keycloak's loopback port, as in Manage people. - Containers on the private network reach the issuer at its public HTTPS name, which
compose.keycloak.yamlgives theproxycontainer as an alias on thebackendnetwork. Your proxy needs the same alias.
Run without the bundled proxy
compose.yaml defines Caddy as the proxy service. To leave it out, start the other services by name:
docker compose up -d --build --wait postgres service console- Compose still needs
CONSOLE_HOST,API_HOSTandACME_EMAILin.env. - The console and the service listen only on the internal Compose network
backend, which has no outside route. Your proxy must join it, with a second network or the host's ports for public traffic, as the bundled proxy does withedge.
Run behind a load balancer
Keep Caddy and send the balancer's traffic to it. Caddy routes by hostname, so the balancer must keep the client's Host header and TLS server name.
| Balancer mode | Caddy's certificates |
|---|---|
| TCP passthrough on 443 and 80 | Caddy's ACME certificates work unchanged. |
| TLS termination, then HTTPS to Caddy on 443 | Caddy needs a certificate the balancer accepts: its own, with port 80 forwarded from the internet, or yours. |
| TLS termination, then plain HTTP to Caddy | Not supported. Caddy redirects HTTP to HTTPS. |
To change Caddy's ports or certificates, write an override file in the private directory and append its absolute path to COMPOSE_FILE in .env, after a :. This one accepts traffic only on a private address and mounts a copy of deploy/keycloak/Caddyfile, or of deploy/Caddyfile without the co-hosted Keycloak, with a tls <certificate> <key> line in each site block. The console trusts only public certificate authorities, so a co-hosted Keycloak's certificate must come from one.
services:
proxy:
ports: !override
- "10.0.0.5:80:80"
- "10.0.0.5:443:443"
volumes:
- /home/ops/.config/acclimate/Caddyfile:/etc/caddy/Caddyfile:ro
- /home/ops/.config/acclimate/certs:/etc/caddy/certs:roCheck the result with docker compose config --quiet, then run docker compose up -d --wait proxy.
When your proxy is in place, run the checks in Verify API access and sign-in through it.