docker-traefik-cloudflare-companion
docker-traefik-cloudflare-companion copied to clipboard
Support for defaultRule
Instead of defining Host label under each service, i have a default rule in the traefik.yml configuration as shown below:
providers:
docker:
endpoint: "unix:///var/run/docker.sock"
exposedByDefault: false
swarmMode: false
network: traefik_2
defaultRule: "Host(`{{ index .Labels \"com.docker.compose.service\"}}.domain.com`)"
Is their any work around for this scenario or possibility to add support?
Really need this feature, too
A possible solution would be to get the hostnames via traefik v2 api (https://doc.traefik.io/traefik/operations/api/). The endpoint /api/http/routers contains every Host rule for all routers. This solution also avoids using the docker socket.
Not being able to use the defaultRule kind of defeats its purpose of the default rule, which is extremely practical when using numerous containers. I agree that adding support for this would really be useful!
I too am effected by this.
I have a current workaround. I have downloaded and edited the main file and loaded into the container as a config.
I removed only 1 line from the file: line 308 (and fixed indentation caused by it)
if "provider" in router and router["provider"] != "docker":
configs:
- source: traefik-cloudflare-companion__fix
target: /usr/sbin/cloudflare-companion
mode: 0755