Import
Creating an HTTPS Server
Basic Server
With PFX Certificate
Class: https.Server
This class is a subclass oftls.Server and emits events same as http.Server.
Methods
server.close([callback])
callback- Returns:
server.listen([port][, host][, callback])
Starts the HTTPS server listening for encrypted connections.server.setTimeout([msecs][, callback])
msecsDefault:120000(2 minutes)callback- Returns:
Properties
server.timeout
- Type: Default: 0 (no timeout)
server.keepAliveTimeout
- Type: Default:
5000(5 seconds)
server.headersTimeout
- Type: Default:
60000
server.maxHeadersCount
- Type: Default:
2000
Class: https.Agent
An Agent object for HTTPS similar tohttp.Agent.
new Agent([options])
optionsmaxCachedSessionsMaximum number of TLS cached sessions. Default:100servernameServer name for SNI (Server Name Indication)- All options from
http.Agent
Event: ‘keylog’
lineLine of ASCII text in NSS SSLKEYLOGFILE formattlsSocketThe TLS socket instance
HTTPS Methods
https.get(url[, options][, callback])
urloptionscallback- Returns:
http.get() but for HTTPS.
https.request(url[, options][, callback])
urloptionsprotocolDefault:'https:'portDefault:443- All options from
http.request() - All options from
tls.connect()
callback- Returns:
TLS/SSL Options
Certificate Options
Client Certificate Authentication
Certificate Validation
Custom Certificate Validation
SNI (Server Name Indication)
Server-side SNI
Client-side SNI
Global Agent
https.globalAgent
Global instance ofhttps.Agent for all HTTPS client requests.