Repository navigation
The registration order of http server listen depends on the Node.js version #53204
Description
Activity
- addedhttpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.
on May 29, 2024 @nodejs/http
Reference: Azure/static-web-apps-cli#829
Looking at the changelogs between 20.12.2 and 20.13.0, I don't see anything that directly says it changed this functionality, but the following commit might be of interest: #52492 . I'm not sure, but it's involving DNS ordering, so it might be worth a look.
Changelog: https://nodejs.org/en/blog/release/v20.13.0
Reacted by Yusuke YamadaI think this is related to this, this PR makes the last
listenis valid. Before this PR, the follow code just listen to127.0.0.1(I think that's not right it should listen to192.168.10.104) instead of both. Maybe we should update the docs.server.listen(8888, "127.0.0.1"); // 20.13 < , this one is used. server.listen(8888, "192.168.10.104" /* replace your local ip address */); // 20.13 >= , this one is used.
Reacted by Aviv Keller, Yusuke Yamada and Marco IppolitoI think this is related to this. this PR makes the last
listenis valid. Before this PR, the follow code just listen to127.0.0.1instead of both. I think that's not right, maybe we should update the docs.server.listen(8888, "127.0.0.1"); // 20.13 < , this one is used. server.listen(8888, "192.168.10.104" /* replace your local ip address */); // 20.13 >= , this one is used.
Ahh that makes more sense
I didn't even know multiple
.listen()was possible. I think we should just error in this case, or add support for multiple interfaces. In Fastify, we handle it with having multiple server instances.github-actions commented
on Jul 31, 2026 on Jul 31, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jul 31, 2026 This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.- removedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Aug 31, 2026
Version
v20.13.1
Platform
Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103 arm64
Subsystem
No response
What steps will reproduce the bug?
The behavior of
Server.listenon the same port has changed between node 20.12 and 20.13.If you execute code like the following,
In node 20.12, 127.0.0.1:8888 (or 0.0.0.0:8888, localhost:8888) is listened to and the
Hello Worldstring is returned.However, in node 20.13, only 192.168.10.104:8888 is listened to, and the rest, such as 127.0.0.1:8888, are not listened to.
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
Both will be LISTENED to, or if there is a specification for the order, that document will be clearly noted.
What do you see instead?
no outputs
Additional information
For example, this is how it is used.
https://github.com/Azure/static-web-apps-cli/blob/352be8f4ce2d01e1dac17797a80f9f414d612bc0/src/msha/server.ts#L173-L174