Web / Traefik Interview questions
What is the difference between TCP routers and HTTP routers in Traefik?
HTTP routers operate on the application layer, matching rules against parsed HTTP data like Host, Path, or headers, and can attach the full range of HTTP middlewares.
| HTTP Router | TCP Router |
| Matches on Host, Path, Headers, Method | Matches mainly on SNI (for TLS) or accepts all traffic (HostSNI(`*`)) |
| Full HTTP middleware support | Very limited middleware support (e.g. IPAllowList) |
| Can terminate TLS and inspect the request | Can pass TLS straight through without decrypting it |
| Used for REST APIs, web apps | Used for databases, raw TCP protocols, TLS passthrough |
Because a TCP router works below the HTTP layer, it's the right tool when the protocol isn't HTTP at all, such as routing a Postgres connection or passing an encrypted TLS stream through to a backend that terminates it itself.
More Related questions...