For TCP connections I would like to have the ability to drop requests to undefined routers.
This topic is often misunderstood with the middleware Errorpage (https://docs.traefik.io/middlewares/errorpages).
However, this is not about reacting to the HTTP status code of an existing route, rather to change the behavior of how Traefik reacts to a non-existent router.
Current behavior is a response with the content "404 Not Found".
The origin of the behavior can be found in
Since the default handler is used. See: https://golang.org/pkg/net/http/#Serve
The handler is typically nil, in which case the DefaultServeMux is used.
DefaultServeMux responds to this with
We have the possibility to change the behavior with a handler, so in this case we can simply close the connection.
A good reference (also with examples) I found in the following article: https://echorand.me/posts/golang-dissecting-listen-and-serve