Is it possible to write a custom TCP middleware?

I would like to write a middleware to inspect a binary protocol which is passed through a traefik load-balancer and which would close the connection if certain conditions are met. It seems writing a custom middleware is the way to go.

I have read the plugin development and the demo plugin pages, and browsed the Plugin Catalogue, but I can only find info on how to make a HTTP middleware. The plugin demo page writes that a middlware plugin provides a http.Handler and does not mention a TCP handler or similar.

Is it possible to develop a middleware for TCP and are there any examples?


Hey @kurt-hectic , currently plugins are only supported for HTTP routers, we'll revisit this in the future while evaluating use cases for TCP and UDP as well.

thanks for the info.

My use case is to check whether the username in the MQTT protocol corresponds to the Subject Alternative Name of the (client side) SSL certificate used to secure the connection. Traefik terminates the SSL connection but passes through the MQTT connection to a downstream MQTT server.

1 Like