Description
Affected URL(s)
https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions
https://nodejs.org/api/tls.html#serveraddcontexthostname-context
Description of the problem
The documentation for tls.createSecureContext() states:
The tls.createSecureContext() method creates a SecureContext object. It is usable as an argument to several tls APIs, such as server.addContext(), but has no public methods. The tls.Server constructor and the tls.createServer() method do not support the secureContext option.
So according to the documentation, server.addContext()
should take a SecureContext
object as an argument. However, according to the documention of server.addContext(), the only valid argument for options
is SecureContextOptions
, but not the SecureContext
object itself.
I have tried passing a SecureContext
object to server.addContext()
. While it did not throw any errors, it did not configure the secure context properly.
It would really be nice if server.addContext()
would take a SecureContext
object. Ideally, you should fix the code and update the documentation for server.addContext()
.
Thank you.