Skip to content

fix(server): Explicitly bind to IPv4 loopback#1354

Merged
RandomByte merged 1 commit intomainfrom
fix/bind-to-v4-loopback
Apr 8, 2026
Merged

fix(server): Explicitly bind to IPv4 loopback#1354
RandomByte merged 1 commit intomainfrom
fix/bind-to-v4-loopback

Conversation

@RandomByte
Copy link
Copy Markdown
Member

In some environments, 'localhost' might resolve to the IPv6 loopback address '::1' which is often unexpected. This can especially lead to problems where other tools might resolve 'localhost' differently in the same environment.

This change explicitly binds to the IPv4 loopback address '127.0.0.1' instead of resolving the address from 'localhost'.

In case remote connections are allowed, no host is specified so that Node.js binds to either the unspecified IPv4 or -IPv6 address (which usually also accepts IPv4 connections) [1]

[1] https://nodejs.org/docs/latest-v25.x/api/net.html#serverlistenport-host-backlog-callback

Cherry-pick of SAP/ui5-server#763

In some environments, 'localhost' might resolve to the IPv6 loopback
address '::1' which is often unexpected. This can especially lead to
problems where other tools might resolve 'localhost' differently in the
same environment.

This change explicitly binds to the IPv4 loopback address '127.0.0.1'
instead of resolving the address from 'localhost'.

In case remote connections are allowed, no host is specified so that
Node.js binds to either the unspecified IPv4 or -IPv6 address (which
usually also accepts IPv4 connections) [1]

[1] https://nodejs.org/docs/latest-v25.x/api/net.html#serverlistenport-host-backlog-callback

Cherry-pick of SAP/ui5-server#763
@RandomByte
Copy link
Copy Markdown
Member Author

Note that this is an up-port of SAP/ui5-server#763

@RandomByte RandomByte requested a review from a team April 7, 2026 14:44
@RandomByte RandomByte merged commit d913c56 into main Apr 8, 2026
30 checks passed
@RandomByte RandomByte deleted the fix/bind-to-v4-loopback branch April 8, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants