Traefik redirect to different subdomains

Hello,
I am trying to redirect requests from my traefik to different subdomains with respect to header info. For example; If https://urltocall.com/subd/api/ is called, I want traefik forward this request to https://subd.urltocall.com/api/. To achieve this I wrote a redirectRegex middleware and called this under my router. But I am having trouble with url under my service's loadbalancer section. I am giving my dynamic configuration yaml below. And I am having http: TLS handshake error from 172.22.0.1:54800: remote error: tls: unknown certificate error in my traefik.log and 404 page not found on browser. Thanks for your valuable ideas.

dynamic_conf.yml

http:
  routers:
    router-redirect:
      entryPoints:
      - ep-redirect
      tls:
        domains:
          - main: "*.urltocall.com"                 
      rule: "PathPrefix(`/{regex:$$|.*}`)"
      middlewares:
        - mw-redirectregex 

  middlewares:
    mw-redirectregex:
      redirectRegex:
        regex: "^https:\/\/urltocall.com\/(.*)\/(.*)\/"
        replacement: "https://$1.urltocall.com/$2/"
        permanent: false      

  services:
    service-redirect:
      loadBalancer:
        servers:
          - url: https://subd.urltocall.com/api/
        passHostHeader: false
        healthCheck:
          path: /
          interval: "10s"
          timeout: "5s"