Creating TCP Router

Continuation of: Does tcp route support middleware

Now that Traefik 2.5 supports middleware on tcp-routers, how would we enable this?

I've tried:

    entryPoints = ["https"]
    rule = "HostSNI(``)"
    service = "ipmi-svc"
    middlewares = ["chain-oauth"]
      certresolver = "dns-cloudflare"
      passthrough = true

        address = ""

But it's stating the middleware doesn't exist.

  • today at 18:17:58 time="2021-09-02T18:17:58+01:00" level=error msg="middleware "chain-oauth@file" does not exist" entryPointName=https routerName=ipmi-rtr@file

Since the feature is quite new, not quite sure how to enact this.

Thanks for any help!

The is only one middleware for TCP and it is:

You need to set labels on your Traefik container


Then set labels on your container that need TCP

 traefik.frontend.priority: 1
  traefik.enable: true
  traefik.backend: mongo
  traefik.tcp.routers.mongo.rule: HostSNI(`*`)
  traefik.tcp.routers.mongo.entrypoints: mongo
  traefik.tcp.routers.mongo.service: mongo 27017
  traefik.tcp.routers.mongo.middlewares: localhost-ip-whitelist@docker


That would explain things.

I'm guessing until further middlewares are created, things like authentication won't work on TCP middleware?