File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,15 @@ Example:
80
80
` listen(port, [host], [callback]) `
81
81
82
82
Begin accepting connections on the specified port and host. If the host is
83
- omitted, the server will accept connections directed to any IPv4 address
84
- (INADDR\_ ANY).
83
+ omitted, the server will accept connections directed to the IPv4 address
84
+ ` 127.0.0.1 ` . To listen on any other address, supply said address as the ` host `
85
+ parameter. For example, to listen on all available IPv6 addresses supply
86
+ ` :: ` as the ` host ` (note, this _ may_ also result in listening on all
87
+ available IPv4 addresses, depending on operating system behavior).
88
+
89
+ We highly recommend being as explicit as possible with the ` host ` parameter.
90
+ Listening on all available addresses (through ` :: ` or ` 0.0.0.0 ` ) can lead
91
+ to potential security issues.
85
92
86
93
This function is asynchronous. The last parameter callback will be called when
87
94
the server has been bound.
Original file line number Diff line number Diff line change @@ -701,13 +701,13 @@ Server.prototype.after = function () {
701
701
} )
702
702
}
703
703
704
- // All these just reexpose the requisite net.Server APIs
704
+ // All these just re-expose the requisite net.Server APIs
705
705
Server . prototype . listen = function ( port , host , callback ) {
706
706
if ( typeof ( port ) !== 'number' && typeof ( port ) !== 'string' ) { throw new TypeError ( 'port (number or path) required' ) }
707
707
708
708
if ( typeof ( host ) === 'function' ) {
709
709
callback = host
710
- host = '0 .0.0.0 '
710
+ host = '127 .0.0.1 '
711
711
}
712
712
if ( typeof ( port ) === 'string' && / ^ [ 0 - 9 ] + $ / . test ( port ) ) {
713
713
// Disambiguate between string ports and file paths
You can’t perform that action at this time.
0 commit comments