From 8f930ef9d4a93e3e0550305b73273a35522ea729 Mon Sep 17 00:00:00 2001 From: Michael Storgaard Date: Tue, 30 Sep 2025 15:35:55 +0200 Subject: [PATCH] fix: skip SNI for IP addresses in TLS connection --- lib/base/connection.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/base/connection.js b/lib/base/connection.js index b8bc90af8a..287f07afd3 100644 --- a/lib/base/connection.js +++ b/lib/base/connection.js @@ -345,7 +345,11 @@ class BaseConnection extends EventEmitter { }); const rejectUnauthorized = this.config.ssl.rejectUnauthorized; const verifyIdentity = this.config.ssl.verifyIdentity; - const servername = this.config.host; + let servername = undefined; + // only set servername for SNI and identity check if host is not an IP address + if (!Net.isIP(this.config.host)) { + servername = this.config.host; + } let secureEstablished = false; this.stream.removeAllListeners('data');