Repository navigation
Description
Summary
We deployed OpenClaw on Coolify (Docker Compose buildpack) and hit two persistent issues that appear common for this stack:
- 503 / No Available Server from the proxy despite the container running.
NOT_PAIRED/ token mismatch even when the gateway token was correct.
Root causes and fixes below. This issue is primarily to:
- propose a small code fix: treat
gateway.trustedProxies: ["*"]as a wildcard - document the exact Coolify requirements so others can deploy without a multi-day debug loop
Root Cause A: Coolify routing for Docker Compose apps
For Compose buildpack apps, Coolify ignores --domains and requires a compose-specific domain mapping.
If not set, Traefik will return 503 (no available server), even if the container is healthy.
Required settings for Coolify Compose
- Ensure
docker-compose.coolify.ymlexists (Coolify buildpack expects this file name). - Ensure the OpenClaw service joins the
coolifynetwork and Traefik uses it:networks: [coolify]on the servicetraefik.docker.network=coolifylabel
- Ensure Traefik routes to the correct port:
traefik.http.services.<svc>.loadbalancer.server.port=3000OPENCLAW_GATEWAY_PORT=3000
- Ensure ports_exposes is set to the same port (Coolify app setting):
3000 - Domain config must be set using
docker_compose_domains(notdomains):- REST API example:
curl -X PATCH \ -H "Authorization: Bearer <token>" \ -H "Content-Type: application/json" \ -d '{"docker_compose_domains":[{"name":"openclaw","domain":"https://example.com"}]}' \ https://<coolify>/api/v1/applications/<uuid>
- REST API example:
Without these
Traefik will answer 503 or route to the wrong backend/port.
Root Cause B: trustedProxies: ["*"] is not honored
We set:
"gateway": { "trustedProxies": ["*"] }However, the runtime only compares exact IPs, so * never matches.
As a result:
remoteIsTrustedProxyis always falseskipDevicePairingForTrustedProxynever kicks in- Control UI requests still require manual pairing
This manifested as:
- Control UI token was correct, but gateway returned
NOT_PAIRED - UI appeared offline even though WS auth succeeded
Proposed fix (small + safe)
Treat * as a true wildcard in isTrustedProxyAddress:
if (trustedProxies.some(p => p.trim() === "*")) return true;Alternatively, if you don’t want wildcard support, docs should explicitly warn that * is not supported and require explicit IPs.
Deployment notes that helped
We also added a bootstrap sync to avoid config/env drift:
- Keep
gateway.auth.tokenandgateway.trustedProxiesinopenclaw.jsonin sync with env on each boot.
This avoided cases where the config file used an old token even when env was correct.
Why this matters
These issues are easy to hit on Coolify because:
- Compose apps require
docker_compose_domains(not obvious in CLI) - Traefik often picks the wrong network without
traefik.docker.network trustedProxies: ["*"]looks like a valid config, but silently fails
If you want, I can open a PR for the wildcard support and/or docs updates.
Activity
jroth1111 commentedon Feb 4, 2026
Additional details to make this fully reproducible on Coolify:
Observed versions
4.0.0-beta.4623.1.7(from/api/v1/applications/<uuid>payload)Compose domain config (CLI limitation)
coolify app update --domainsfails with 422 for docker-compose apps.Routing requirements that cause 503 if missed
ports_exposesmust match the gateway port (e.g.3000). If left at 80, Traefik can route incorrectly even with labels.traefik.http.routers.openclaw.rule=Host(...)traefik.http.routers.openclaw.entrypoints=httpstraefik.http.services.openclaw.loadbalancer.server.port=3000traefik.docker.network=coolify(critical)coolifynetwork (networks: [coolify]).docker-compose.coolify.yml(not justdocker-compose.yaml).Config/env drift
openclaw.jsontoken overrides env. If config is persisted, stale token causestoken_mismatch. Boot-time sync prevents this.Trusted proxy + auto-pairing
gateway.trustedProxies: ["*"]previously failed because only exact IPs matched. This preventsskipDevicePairingForTrustedProxyfrom ever firing.src/gateway/net.tsto treat*as wildcard; or explicitly document that*is unsupported and require IPs/CIDRs.Common symptoms
503 No Available Serverunauthorized: gateway token mismatchNOT_PAIREDProxy headers detected from untrusted addressopenclaw-barnacle commentedon Feb 17, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
jroth1111 commentedon Feb 17, 2026
These issues and solutions could be used in a PR to use with coolify. Not sure much to add.
openclaw-barnacle commentedon Feb 24, 2026
This issue has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.
openclaw-barnacle commentedon Mar 7, 2026
Closing due to inactivity.
If this is still an issue, please retry on the latest OpenClaw release and share updated details.
If you are absolutely sure it still happens on the latest release, open a new issue with fresh repro steps.