-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
Description
Our protocol detection logic currently only works for client-speaks-first protocols--where the client immediately sends data upon the TCP connection completing. MySQL and some other protocols are server-speaks-first; the client won't send anything on the connection until the server sends something. We should change the protocol detection logic so that it is insensitive to which side speaks first, insofar as that is possible.
Currently in Conduit 0.2 we document that the user must explicitly configure the proxy to turn off L7 features for server-speaks-first protocols. This is counter to our goal to "just work" with zero configuration.
A potential strategy:
- Assume at first that the underlying service being proxied always speaks one protocol.
- Assume the underlying service speaks TCP (not HTTP) until we get a positive indication otherwise.
- When we haven't marked the underlying service as speaking HTTP, as soon as we receive an incoming connection or making an outgoing connection, start the connection to the destination (in the inbound case, this would be the connection to the underlying service; in the outbound case, this would be the connection to the external service). Note that this is insensitive to which side speaks first. Mark the protocol for this as "TBD".
- If/when a client speaks first on a "TBD" connection, run our HTTP (and eventually TLS) detection logic. If/when that logic indicates HTTP and/or gRPC then reconfigure the connection as a HTTP (and/or gRPC) connection and mark the underlying service as HTTP. In particular, add it to the pool of connections for L7 HTTP load balancing.