Make sure we use correct MSG prefix when mixing between leafnodes and routes.

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2019-05-01 15:08:20 -07:00
parent 628c373299
commit 1d736ccc61
4 changed files with 77 additions and 1 deletions

View File

@@ -503,6 +503,12 @@ func (s *Server) createLeafNode(conn net.Conn, remote *leafNodeCfg) *client {
url := c.leaf.remote.getCurrentURL()
host, _, _ := net.SplitHostPort(url.Host)
// We need to check if this host is an IP. If so, we probably
// had this advertised to us an should use the configured host
// name for the TLS server name.
if net.ParseIP(host) != nil {
host, _, _ = net.SplitHostPort(c.leaf.remote.RemoteLeafOpts.URL.Host)
}
tlsConfig.ServerName = host
c.nc = tls.Client(c.nc, tlsConfig)