Skip to content

Conversation

@nihalchollampat
Copy link

@nihalchollampat nihalchollampat commented Nov 20, 2025

Closes #7289
PR Description
This PR improves Traefik rule generation by ensuring Host() is only emitted when a host value actually exists, and by normalizing paths so that all middleware, regex, StripPrefix, and router labels use consistent values.
What’s changed:
*Added a new buildTraefikRule helper to centralize rule construction.
*Normalized path handling (treat '' and '/' as no-path).
*Ensured PathPrefix() receives a properly normalized path (leading slash enforced).
*Prevented invalid configurations like: Host("") && PathPrefix(coolify.io). which previously caused 404 routing failures.
*Updated the code to rely on normalized path values from fqdnLabelsForTraefik / fqdnLabelsForCaddy.
Why
Previously, empty hosts combined with non-normalized paths resulted in Traefik misrouting — especially cases where the router generated Host("").
This PR eliminates those invalid rules and ensures predictable routing behavior.
Testing
Verified rule output from the helper for all combinations:
*host only
*path only
*both
*neither (falls back to PathPrefix(/))
*Confirmed Traefik labels no longer include empty hosts.
*Verified middleware + ghost regex + StripPrefix use normalized paths.
Files Changed
docker.php

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.

[Bug]: Domain parsing bug in v4.0.0-beta.444 - generates incorrect Traefik rules

1 participant