Traefik fails to serve https endpoint inside docker

I am trying to configure traefik with docker provider. It works fine with http, but after enabling https it stops working. When you are trying to go over https it constantly returns:

curl: (7) Failed to connect to test.**** port 443: Connection refused

All testing happens via curl like that:

curl http://test.*** 
curl https://test.*** 

According to logs, all certificates are generated without issues. It is a pretty basic configuration and I have no clue what can be wrong. Did someone encounter something like that in the past?

Debug logs:

reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="No entryPoint defined for this router, using the default one(s) instead: [web websecure]" routerName=reverse-proxy
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="No entryPoint defined for this router, using the default one(s) instead: [web websecure]" routerName=whoami
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Adding certificate for domain(s) test.***"
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Adding certificate for domain(s) ***.***"
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Adding certificate for domain(s) ***"
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="No default certificate, generating one"
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Added outgoing tracing middleware api@internal" routerName=api@internal middlewareName=tracing middlewareType=TracingForwarder entryPointName=traefik
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Added outgoing tracing middleware dashboard@internal" routerName=dashboard@internal middlewareType=TracingForwarder middlewareName=tracing entryPointName=traefik
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" middlewareType=StripPrefix entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_stripprefix@internal
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Adding tracing to middleware" middlewareName=dashboard_stripprefix@internal entryPointName=traefik routerName=dashboard@internal
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Setting up redirection from ^(http:\\/\\/[^:\\/]+(:\\d+)?)\\/$ to ${1}/dashboard/" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal middlewareType=RedirectRegex
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Adding tracing to middleware" entryPointName=traefik routerName=dashboard@internal middlewareName=dashboard_redirect@internal
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" entryPointName=traefik middlewareName=traefik-internal-recovery middlewareType=Recovery
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Added outgoing tracing middleware noop@internal" middlewareName=tracing middlewareType=TracingForwarder entryPointName=web routerName=web-to-websecure@internal
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" entryPointName=web routerName=web-to-websecure@internal middlewareType=RedirectScheme middlewareName=redirect-web-to-websecure@internal
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Setting up redirection to https 443" middlewareName=redirect-web-to-websecure@internal entryPointName=web routerName=web-to-websecure@internal middlewareType=RedirectScheme
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Adding tracing to middleware" routerName=web-to-websecure@internal middlewareName=redirect-web-to-websecure@internal entryPointName=web
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" routerName=reverse-proxy@docker middlewareType=Pipelining middlewareName=pipelining serviceName=reverse-proxy-traefic entryPointName=web
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating load-balancer" serviceName=reverse-proxy-traefic entryPointName=web routerName=reverse-proxy@docker
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating server 0 http://172.23.0.2:80" serviceName=reverse-proxy-traefic serverName=0 entryPointName=web routerName=reverse-proxy@docker
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Added outgoing tracing middleware reverse-proxy-traefic" routerName=reverse-proxy@docker middlewareName=tracing middlewareType=TracingForwarder entryPointName=web
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" middlewareType=Pipelining entryPointName=web routerName=whoami@docker serviceName=whoami-traefic middlewareName=pipelining
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating load-balancer" routerName=whoami@docker serviceName=whoami-traefic entryPointName=web
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating server 0 http://172.23.0.3:80" routerName=whoami@docker serviceName=whoami-traefic entryPointName=web serverName=0
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Added outgoing tracing middleware whoami-traefic" entryPointName=web routerName=whoami@docker middlewareName=tracing middlewareType=TracingForwarder
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" middlewareType=Recovery entryPointName=web middlewareName=traefik-internal-recovery
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" serviceName=reverse-proxy-traefic middlewareName=pipelining middlewareType=Pipelining entryPointName=websecure routerName=websecure-reverse-proxy@docker
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating load-balancer" entryPointName=websecure routerName=websecure-reverse-proxy@docker serviceName=reverse-proxy-traefic
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating server 0 http://172.23.0.2:80" entryPointName=websecure routerName=websecure-reverse-proxy@docker serviceName=reverse-proxy-traefic serverName=0
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Added outgoing tracing middleware reverse-proxy-traefic" middlewareName=tracing middlewareType=TracingForwarder entryPointName=websecure routerName=websecure-reverse-proxy@docker
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" middlewareName=pipelining middlewareType=Pipelining entryPointName=websecure routerName=websecure-whoami@docker serviceName=whoami-traefic
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating load-balancer" entryPointName=websecure routerName=websecure-whoami@docker serviceName=whoami-traefic
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating server 0 http://172.23.0.3:80" entryPointName=websecure routerName=websecure-whoami@docker serviceName=whoami-traefic serverName=0
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Added outgoing tracing middleware whoami-traefic" routerName=websecure-whoami@docker middlewareName=tracing middlewareType=TracingForwarder entryPointName=websecure
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Creating middleware" entryPointName=websecure middlewareName=traefik-internal-recovery middlewareType=Recovery
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Try to challenge certificate for domain [***] found in HostSNI rule" routerName=websecure-reverse-proxy@docker rule="Host(`***`)" providerName=defaultResolver.acme
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Try to challenge certificate for domain [test.***] found in HostSNI rule" providerName=defaultResolver.acme routerName=websecure-whoami@docker rule="Host(`test/.***`)"
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Looking for provided certificate(s) to validate [\"test.***\"]..." providerName=defaultResolver.acme routerName=websecure-whoami@docker rule="Host(`test.***`)"
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="No ACME certificate generation required for domains [\"***\"]." providerName=defaultResolver.acme routerName=websecure-whoami@docker rule="Host(`test.***`)"
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="Looking for provided certificate(s) to validate [\"***\"]..." rule="Host(`***`)" providerName=defaultResolver.acme routerName=websecure-reverse-proxy@docker
reverse-proxy_1  | time="2020-06-19T18:43:54Z" level=debug msg="No ACME certificate generation required for domains [\"***\"]." providerName=defaultResolver.acme routerName=websecure-reverse-proxy@docker rule="Host(`***`)"

docker-compose.yml

version: '3'

services:
  reverse-proxy:
    image: traefik:v2.2
    ports:
      - 80:80
      - 433:433
      - 8080:8080
    volumes:
      - ./acme.json:/acme.json
      - ./traefik.yml:/etc/traefik/traefik.yml
      - /var/run/docker.sock:/var/run/docker.sock

    labels:
      - traefik.http.routers.reverse-proxy.rule=Host(`***`)


  whoami:
    image: containous/whoami
    command:
      - --port=80
    labels:
      - traefik.http.routers.whoami.rule=Host(`test.***`)
      - traefik.http.routers.whoami.entrypoints=websecure
      - traefik.http.routers.whoami.tls.certresolver=leresolver
    depends_on: 
      - reverse-proxy

traefik.yml

log:
  level: WARN

providers:
  docker:
    defaultRule: "HostRegexp(`{host:.+}`)"

entryPoints:
  web:
    address: ":80"

  websecure:
    address: ":443"

certificatesResolvers:
  leresolver:
    acme:
      email: ***@***.com  
      storage: ./acme.json
      caServer: https://acme-staging-v02.api.letsencrypt.org/directory
      httpChallenge:
        entryPoint: web

api:
  insecure: true

Wecome @byme

Typo in your services ports definition:

Em... I spent two days on it.. Thank you!

:smiley: I guess that is why we have thing like forums.