HostSNI not working

Hello guys,

I'm trying to implement Traefik as a TCP Proxy for several mongoDB servers, but something it's not working.

I have several deployments for my developers, dev, staging, qa, etc and each of them are a suite of containers like backend, mongo, log-shipper etc.

For each of this deployments, I'm registering different http routers in Traefik, for example,, etc and everything works fine except mongo part.

This is my main goal: for each deployment in different environments, I want to have a TCP endpoint to the respective mongo instance.

This are the labels that I'm using to do it:


As you can see I'm using Nomad and Consul to help me with all this environments, but this config it's not working.

I made some tries, and I found that if I change this line "traefik.tcp.routers.mongo-dev.rule=HostSNI( )" to this "traefik.tcp.routers.mongo-dev.rule=HostSNI( * )" , it works (I can use Mongo Compass to access to the databases) but I'm afraid that, with several TCP Routers (for the different environments -,, etc), it will not make differentiate between the different mongo hosts and start to make a round robin choise.

I'm using Traefik v 2.1.4

What am I doing wrong?

Thanks a lot.

I have the same problem with Traefik v2.2

There is a solution for HostSNI and a mongodb ???

1 Like

After several test I found a solution.
For the HostSNI we need a tls and now the connection is valid :

      - traefik.enable=true

1 Like