Override Consul port via tags

When I have a service defined in Consul and I'm using the ConsulCatalog provider, I cannot seem to override the port.

If Consul has the port number as 38729, and I have the following tag set on the service:
"traefik.http.services.myservicename.loadbalancer.server.port=443"

  • Traefik still "sees" the 38729 port

I can confirm I can change things about the loadbalancer by adding the following tag:
"traefik.http.services.v2-services-main-pc-playhawken-com.loadbalancer.server.scheme=https"

  • And it has the expected result of changing it to use "https" when routing to the service.

Other posts that seem related:

That second thread seems to indicate Traefik will not override the port, even when the tag is set. I would like to be able to override the port that Traefik routes to.

The other aspect is that if Consul doesn't have a port number specified for a service, I still can't override that via tags. Defining that "....loadbalancer.port=9995" tag results in a port value of "0" showing up in Traefik.

The use case this would support is:

  • Have Traefik instances listening on 443, routing via TLS to other Traefik instances listening on a consistent port such as 9995, and those will route only to locally-hosted services. This way I can have edge routers that route to traefik instances that route to services, and all traffic is encrypted, and I can minimize firewall exceptions.

Hello,

It's a bug, I opened a PR to fix that:

Awesome. I pulled your changes and built the binaries for Windows specifically, and everything seems to work. I'm able to override the port to which Traefik sends traffic to backend servers.