Skip to content

Coolify deploy: trustedProxies wildcard not honored; compose routing gotchas #8577

Closed as not planned

Description

@jroth1111

Summary

We deployed OpenClaw on Coolify (Docker Compose buildpack) and hit two persistent issues that appear common for this stack:

  1. 503 / No Available Server from the proxy despite the container running.
  2. 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.yml exists (Coolify buildpack expects this file name).
  • Ensure the OpenClaw service joins the coolify network and Traefik uses it:
    • networks: [coolify] on the service
    • traefik.docker.network=coolify label
  • Ensure Traefik routes to the correct port:
    • traefik.http.services.<svc>.loadbalancer.server.port=3000
    • OPENCLAW_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 (not domains):
    • 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>

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:

  • remoteIsTrustedProxy is always false
  • skipDevicePairingForTrustedProxy never 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.token and gateway.trustedProxies in openclaw.json in 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

  1. jroth1111 commented on Feb 4, 2026

    @jroth1111
    Author

    Additional details to make this fully reproducible on Coolify:

    Observed versions

    • Coolify: 4.0.0-beta.462
    • Traefik: 3.1.7 (from /api/v1/applications/<uuid> payload)

    Compose domain config (CLI limitation)

    • coolify app update --domains fails with 422 for docker-compose apps.
    • Compose apps require docker_compose_domains. Working API shape:
    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>

    Routing requirements that cause 503 if missed

    • ports_exposes must match the gateway port (e.g. 3000). If left at 80, Traefik can route incorrectly even with labels.
    • Required labels for compose routing:
      • traefik.http.routers.openclaw.rule=Host(...)
      • traefik.http.routers.openclaw.entrypoints=https
      • traefik.http.services.openclaw.loadbalancer.server.port=3000
      • traefik.docker.network=coolify (critical)
    • Service must join coolify network (networks: [coolify]).
    • Coolify buildpack expects docker-compose.coolify.yml (not just docker-compose.yaml).

    Config/env drift

    • openclaw.json token overrides env. If config is persisted, stale token causes token_mismatch. Boot-time sync prevents this.

    Trusted proxy + auto-pairing

    • gateway.trustedProxies: ["*"] previously failed because only exact IPs matched. This prevents skipDevicePairingForTrustedProxy from ever firing.
    • Recommend fix in src/gateway/net.ts to treat * as wildcard; or explicitly document that * is unsupported and require IPs/CIDRs.

    Common symptoms

    • 503 No Available Server
    • unauthorized: gateway token mismatch
    • NOT_PAIRED
    • Proxy headers detected from untrusted address
  2. added
    bug
    on Feb 4, 2026
  3. openclaw-barnacle commented on Feb 17, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  4. added
    stale
    on Feb 17, 2026
  5. jroth1111 commented on Feb 17, 2026

    @jroth1111
    Author

    These issues and solutions could be used in a PR to use with coolify. Not sure much to add.

  6. removed
    stale
    on Feb 17, 2026
  7. openclaw-barnacle commented on Feb 24, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  8. added
    stale
    on Feb 24, 2026
  9. openclaw-barnacle commented on Mar 7, 2026

    @openclaw-barnacle

    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.

  10. locked as resolved and limited conversation to collaborators on Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugstale

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions