Skip to content

Commit 6dc5417

Browse files
mildsunriselundibundi
authored andcommitted
doc: warn that tls.connect() doesn't set SNI
Add a note warning users that when using tls.connect(), the `servername` option must be set explicitely to enable SNI, otherwise the connection could fail. PR-URL: #33855 Fixes: #28167 Co-authored-by: Denys Otrishko <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent 6014e4e commit 6dc5417

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/tls.md

+6
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,12 @@ The `callback` function, if specified, will be added as a listener for the
14031403

14041404
`tls.connect()` returns a [`tls.TLSSocket`][] object.
14051405

1406+
Unlike the `https` API, `tls.connect()` does not enable the
1407+
SNI (Server Name Indication) extension by default, which may cause some
1408+
servers to return an incorrect certificate or reject the connection
1409+
altogether. To enable SNI, set the `servername` option in addition
1410+
to `host`.
1411+
14061412
The following illustrates a client for the echo server example from
14071413
[`tls.createServer()`][]:
14081414

0 commit comments

Comments
 (0)