Make frontend listen on both IPv4 and IPv6 by default #19660
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR drops the default listening IPv4 address for the frontend and subsequently enables IPv4 + IPv6 (Dual Stack) for it by default.
Enforcing to listen on
0.0.0.0
by default artificially limits a user to access the frontend via IPv4-only. This means it cannot be accessed via IPv6 at all.As long as a user doesn't explicitly configures IPv4-only, I think the frontend should be available on both stacks by default.
My changes allow
frontend.host
to also benull
, so thatlisten()
will be called with no host, but the port only. When called without a host,listen()
will listen on all interfaces on both IPv4 and IPv6 (https://nodejs.org/docs/latest/api/net.html#serverlistenport-host-backlog-callback).This behavior has the advantages that
Manually specifying
host: "0.0.0.0"
(to keep binding IPv4-only) is of course still possible.If IPv6 is disabled system-wide (e.g. by setting
sysctl net.ipv6.conf.all.disable_ipv6 1
), Node.js will fallback to binding IPv4-only.I tested these changes by the following setups and the default config of
frontend: true
: