Skip to content

[FIX] Explicitly bind to IPv4 loopback#763

Merged
RandomByte merged 1 commit into
v4from
fix/bind-to-v4-loopback
Jan 23, 2026
Merged

[FIX] Explicitly bind to IPv4 loopback#763
RandomByte merged 1 commit into
v4from
fix/bind-to-v4-loopback

Conversation

@RandomByte
Copy link
Copy Markdown
Member

@RandomByte RandomByte commented Dec 8, 2025

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

@RandomByte RandomByte requested a review from a team December 8, 2025 15:50
@RandomByte RandomByte force-pushed the fix/bind-to-v4-loopback branch 2 times, most recently from 8a688bd to 31b5018 Compare December 9, 2025 09:00
@maxreichmann
Copy link
Copy Markdown
Member

maxreichmann commented Dec 9, 2025

Unfortunately at least for me, while testing with Docker engine v28.3.0, this didn't fix the issue with ui5-test-runner not finding the local server.

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
@RandomByte RandomByte force-pushed the fix/bind-to-v4-loopback branch from 31b5018 to bb990ac Compare December 17, 2025 08:49
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 93.066%. remained the same
when pulling bb990ac on fix/bind-to-v4-loopback
into cbdc49c on v4.

@RandomByte
Copy link
Copy Markdown
Member Author

Unfortunately at least for me, while testing with Docker engine v28.3.0, this didn't fix the issue with ui5-test-runner not finding the local server.

I would still like to merge this PR as it resolved the issue in my testing. We should investigate your case again to understand the root cause there.

@RandomByte RandomByte merged commit 9d3c252 into v4 Jan 23, 2026
18 checks passed
@RandomByte RandomByte deleted the fix/bind-to-v4-loopback branch January 23, 2026 08:12
RandomByte added a commit to UI5/cli that referenced this pull request Apr 7, 2026
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 added a commit to UI5/cli that referenced this pull request Apr 8, 2026
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
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.

4 participants