diff --git a/dsn.go b/dsn.go index ac00dcedd..5c828bf90 100644 --- a/dsn.go +++ b/dsn.go @@ -494,6 +494,10 @@ func parseDSNParams(cfg *Config, params string) (err error) { if boolValue { cfg.TLSConfig = "true" cfg.tls = &tls.Config{} + host, _, err := net.SplitHostPort(cfg.Addr) + if err == nil { + cfg.tls.ServerName = host + } } else { cfg.TLSConfig = "false" }