How to route HTTPS (443) to a custom port in a service/container?

I'm getting confused as to what is a working way of routing https://[url.com] to [service]:10101

Assuming the container code that's running is correctly set up to listen for requests on port 10101, I've gathered that I at least need to expose the port for Traefik to be aware of it.

What I can't figure out though, is how to connect Traefik with the container so that the requests https://[url.com] are routed to the service on port 10101. I have tried to use a multitude of things, unfortunately I haven't found a way other that using Curl to poke the URL and read the results to see if things seem to work.

Things I have tried;

  • Exposing 10101 on the service
  • Defining traefik.port=10101 in the labels section of the service
  • Defining services within the labels section
    • traefik.http.routers.my-service-secure.service=ms-secure
    • Defining traefik.http.services.ms.loadbalancer.server.port=10101 in the labels section of the service

Nothing regarding this kind of routing has worked so far; I can't seem to get the service/container that is running on port 10101 to get any traffic from `https://[url.com]. I know that something is working on the service, because automatic redirects from port 80 to port 443 are respected.

Any hints about this is highly appreciated.

the correct label for v2 is

"traefik.http.services.my-service-secure.loadbalancer.server.port=10101"

traefik.port is not used and traefik.http.routers.my-service-secure.service=ms-secure is only usefull if you have multiple traefik services for one container.