Skip to content

[Bug]: Traefik Router Rule Hatası – Host("") && PathPrefix(...) Coolify v4.0.0-beta.442 #7201

@mevatech-dev

Description

@mevatech-dev

Error Message and Logs

Hi,
I’m experiencing an issue in Coolify v4.0.0-beta.442 when attaching a custom domain to an application.
Traefik generates an invalid router rule, which causes the app to be unreachable with a “502 Bad Gateway” error.

What Happens:

When I set the domain as www.domain.com (without https://) → it doesn’t work.

When I set it as https://www.domain.com → still doesn’t work, and I get a Bad Gateway error.

In both cases, Coolify generates this incorrect Traefik rule:

traefik.http.routers.http-0-xxxx.rule=Host(``) && PathPrefix(/)

The Host() part is empty, so Traefik rejects the rule.

Logs:
error while adding rule Host()... empty args for matcher Host

What I Tried:

Manually editing .env and Traefik labels → doesn’t persist; Coolify overwrites it on every redeploy.

Changed the domain mode (only “www” or only root, instead of “both”) → still the same issue.

Added a manual dynamic Traefik config file under /data/coolify/proxy/dynamic/ with the correct Host("www.domain.com") rule → it works temporarily, but gets reset after redeploy.

Expected Behavior:

Coolify should generate a valid rule like:

traefik.http.routers.http-0-xxxx.rule=Host(www.domain.com) && PathPrefix(/)

or if both www and non-www are allowed:

Host(domain.com, www.domain.com)

Summary:

No matter if I use www.domain.com or https://www.domain.com, the generated rule always leaves Host() empty.
As a result, Traefik fails to create the router and the site returns “502 Bad Gateway”.
https://ibb.co/1fMqsSRt

Steps to Reproduce

Example Repository URL

No response

Coolify Version

v4.0.0-beta.442

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 Possible BugReported issues that need to be reproduced by the team.🔍 TriageIssues that need assessment and prioritization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions