neuralgia.

lessons from the trenches.

Traefik behind Traefik.

Ran into a bit of trouble today trying to get my Traefik instance to play nice… behind another Traefik instance.

Thinking back it was probably a no-brainer, but Traefik as a proxy should be able to handle such requests with ease:

http:
  routers:
    MyRouter:
      entryPoints:
        - web
        - websecure
      rule: HostSNI(`mywebsite.com`)
      service: MyService
      tls:
        passthrough: true

  services:
    MyService:
      loadBalancer:
        servers:
          - address: "<my server's IP address>:443"

Seems elementary, but Traefik kept complaining about something:

time="2022-05-21T15:36:18Z" level=error msg="Error occurred during watcher callback: /mnt/configs/MyWebsite.com.yml: field not found, node: passthrough" providerName=file

On close inspection, it should be TCP instead, which makes sense:

tcp:
  routers:
    MyRouter:
      entryPoints:
        - web
        - websecure
      rule: HostSNI(`mywebsite.com`)
      service: MyService
      tls:
        passthrough: true

  services:
    MyService:
      loadBalancer:
        servers:
          - address: "<my server's IP address>:443"

After making the changes, Traefik was more than happy to do its job to forward all requests to my other Traefik. I know it’s working because that’s how I typed this post and posted it online.

Leave a Reply

Your email address will not be published. Required fields are marked *