I am looking for a way to redirect an ssh connection from one host to another. When a user creates an ssh connection to host foo, I would like the server to return some response which causes the ssh client to close the ssh connection to foo and instead connect to host bar.
Importantly, for the application I have in mind it is not okay to simply forward the ssh connection to bar via foo, so standard port forwarding is out of the question. Once the redirection occurs, the client should be sending TCP packets directly to bar, not to foo (and not to bar via foo).
So, roughly, I'm looking for an SSH analogue to an HTTP redirect (which causes the client to hang up the original connection and connect instead to the host to which it was redirected).
It is also important for the application I have in mind that this not require any client-side configuration.
So is it possible to do this?