Skip to content

Conversation

@AlemzhanJ
Copy link

Summary

  • Adds support for wildcard domains (*.domain.com) in Traefik v3
  • Introduces generateTraefikHostRule() helper that generates correct syntax based on domain type:
    • Regular domains: Host(domain.com)
    • Wildcard domains: HostRegexp(^.+.domain.com$)

Problem

Dokploy currently generates Host(*.domain.com) for wildcard domains, which doesn't work in Traefik v3. The correct syntax for Traefik v3 is HostRegexp(^.+.domain.com$).

Changes

File Change
packages/server/src/utils/traefik/host-rule.ts New helper function
packages/server/src/utils/traefik/domain.ts Use helper for application domains
packages/server/src/utils/docker/domain.ts Use helper for docker-compose labels
apps/dokploy/__test__/traefik/host-rule.test.ts Unit tests for helper
apps/dokploy/__test__/compose/domain/host-rule-format.test.ts Integration tests for wildcard domains

References

Traefik v3 changed the syntax for wildcard domain routing.
Previously, Dokploy generated `Host(`*.domain.com`)` which doesn't
work in Traefik v3.

This change introduces a helper function that generates the correct
routing rule based on domain type:
- Regular domains: `Host(`domain.com`)`
- Wildcard domains: `HostRegexp(`^.+\.domain\.com$`)`

Affects both application domains (dynamic YAML config) and
docker-compose domains (container labels).

Refs:
- https://doc.traefik.io/traefik/v3.0/routing/routers/
- https://community.traefik.io/t/how-to-create-a-router-rule-for-a-wildcard/19850
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