@@ -444,6 +444,25 @@ export type HttpsOptions = {
444444 // From `tls.ConnectionOptions`
445445 checkServerIdentity ?: CheckServerIdentityFunction ;
446446
447+ /**
448+ Server name for the [Server Name Indication (SNI)](https://en.wikipedia.org/wiki/Server_Name_Indication) TLS extension.
449+
450+ This is useful when requesting to servers that don't have a proper domain name but use a certificate with a known CN/SAN.
451+
452+ @example
453+ ```
454+ import got from 'got';
455+
456+ // Request to IP address with specific servername for TLS
457+ await got('https://192.168.1.100', {
458+ https: {
459+ serverName: 'example.com'
460+ }
461+ });
462+ ```
463+ */
464+ serverName ?: string ;
465+
447466 // From `tls.SecureContextOptions`
448467 /**
449468 Override the default Certificate Authorities ([from Mozilla](https://ccadb-public.secure.force.com/mozilla/IncludedCACertificateReport)).
@@ -809,6 +828,7 @@ const defaultInternals: Options['_internals'] = {
809828 alpnProtocols : undefined ,
810829 rejectUnauthorized : undefined ,
811830 checkServerIdentity : undefined ,
831+ serverName : undefined ,
812832 certificateAuthority : undefined ,
813833 key : undefined ,
814834 certificate : undefined ,
@@ -2278,6 +2298,7 @@ export default class Options {
22782298
22792299 assert . any ( [ is . boolean , is . undefined ] , value . rejectUnauthorized ) ;
22802300 assert . any ( [ is . function , is . undefined ] , value . checkServerIdentity ) ;
2301+ assert . any ( [ is . string , is . undefined ] , value . serverName ) ;
22812302 assert . any ( [ is . string , is . object , is . array , is . undefined ] , value . certificateAuthority ) ;
22822303 assert . any ( [ is . string , is . object , is . array , is . undefined ] , value . key ) ;
22832304 assert . any ( [ is . string , is . object , is . array , is . undefined ] , value . certificate ) ;
@@ -2514,6 +2535,7 @@ export default class Options {
25142535 pfx : https . pfx ,
25152536 rejectUnauthorized : https . rejectUnauthorized ,
25162537 checkServerIdentity : https . checkServerIdentity ?? checkServerIdentity ,
2538+ servername : https . serverName ,
25172539 ciphers : https . ciphers ,
25182540 honorCipherOrder : https . honorCipherOrder ,
25192541 minVersion : https . minVersion ,
0 commit comments