Skip to content

Declare the port a reverse proxy should send traffic to - #13

Merged
Loa212 merged 1 commit into
mainfrom
fix/coolify-expose-port
Jul 30, 2026
Merged

Declare the port a reverse proxy should send traffic to#13
Loa212 merged 1 commit into
mainfrom
fix/coolify-expose-port

Conversation

@Loa212

@Loa212 Loa212 commented Jul 30, 2026

Copy link
Copy Markdown
Owner

What changed

  • add expose: ["3000"] alongside the existing ports mapping
  • correct a comment on container_name that named the wrong cause

Why

Coolify generates Traefik routers from the compose file, but reads expose to learn the backend port. With only a published ports mapping, the generated labels contain routers:

traefik.http.routers.https-0-….rule=Host(`nudo.loa212.com`) && PathPrefix(`/`)

but no traefik.http.services.….loadbalancer.server.port. Traefik matches the host and then has nowhere to send the request — a 502 in front of a container that is running and healthy (nudo is running — open the dashboard to finish setup dashboard=0.0.0.0:3000).

expose is redundant for a plain docker compose up, where the published port already reaches the container. It is kept alongside ports rather than replacing it so localhost:3000 keeps working, as the README documents.

The container_name comment added in #12 named a cause that the generated compose disproves: Coolify overrides that key with its own name (nudo-hwi4754bcs2gz3o9ri2az61n-082055878291), so it was never why the proxy could not reach the container. Dropping the key is still right — nothing refers to the container by name — but the stated reason was wrong.

Validation

  • NUDO_SECRET_KEY=validation-only docker compose config --quiet
  • resolved config carries both expose: ["3000"] and published: "3000", so neither path regresses
  • git diff --cached --check

Coolify generates Traefik routers from the compose file, but it reads
`expose` to learn the backend port. With only a published `ports` mapping it
emitted routers with no `loadbalancer.server.port`, so Traefik matched the
host and then had nowhere to send the request: a 502 in front of a container
that was running and healthy.

`expose` is redundant for a plain `docker compose up`, where the published
port already reaches the container. It is kept alongside `ports` rather than
replacing it so `localhost:3000` keeps working, as the README documents.

Also drops a comment on container_name that named the wrong cause. Coolify
overrides that key with its own generated name, so it was never the reason
the proxy could not reach the container.
@Loa212
Loa212 merged commit 87dfa2f into main Jul 30, 2026
3 checks passed
@Loa212
Loa212 deleted the fix/coolify-expose-port branch July 30, 2026 08:36
Loa212 added a commit that referenced this pull request Jul 30, 2026
Coolify decides the Traefik backend port by parsing it out of the domain
string — `https://nudo.example.com:3000` — and emits the label naming that
port only when it finds one. Without it the generated config has a router
matching the hostname and no service behind it, so the proxy answers 502 in
front of a container that started and passed its healthcheck. Nothing about
the compose file changes that, which is what makes it worth writing down:
`expose`, a published `ports` mapping and the predefined-network toggle all
look like the thing to reach for and none of them are.

Also corrects the comment on `expose` added in #13, which claimed Coolify
reads that key to learn the port. It does not. The key is kept because
stating the dashboard's port in the file is worth a line on its own, but the
reason given for it was wrong.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant