Repository navigation
Conversation
`next start -H 0.0.0.0` makes Next.js repeat the bind address in its own
"Network:" line, so the only startup URL printed is one that no other machine
can open. Next only enumerates the host's addresses when `-H` is absent, and
pi-web always passes it.
When the effective hostname is `0.0.0.0`, `::` or `[::]`, print one line per
non-internal interface of the bound family once the server is ready:
Reachable at:
eth0 http://192.168.1.20:30141
The bind address is unchanged, and the loopback URL the browser opener uses
stays as it was.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
pi-web -H 0.0.0.0printsas the only startup URL meant for another machine, and no machine can open it.
bin/pi-web.jsalways forwards the bind address to Next (nextArgs.push("-H", hostname)), and Next'sstart-serveronly looks at the host's interfaces when-His absent:So with a wildcard bind the banner repeats the flag value. pi-web itself never calls
os.networkInterfaces(), so nothing in the output names an interface or gives a reachable address — while the README recommends--hostname 0.0.0.0for phone/LAN access.Fixes #1375.
Change
bin/network-addresses.js(new):formatReachableAddresses(hostname, port)returns""unless the hostname is0.0.0.0,::or[::]. Otherwise it lists every non-internal address of the bound family, skipping scoped IPv6 (a link-local address needs a zone id and cannot be pasted into another machine's browser), one line per interface, names padded to a single column:Port 0 prints nothing, because the OS picks a port the launcher never learns.
bin/pi-web.js: prints that block once, on "Ready", after Next's banner. The bind address, the authentication warning and the loopback URL the browser opener uses are unchanged.lib/network-addresses.test.mjs(new): wildcard detection, IPv4 and IPv6 enumeration, loopback/scoped filtering, alignment, and the two empty cases.Verification
node --test lib/network-addresses.test.mjs lib/pi-web-options.test.mjs lib/pi-web-cli-commands.test.mjs: 39 pass.npx eslinton the three changed files: clean.npx tsc --noEmit: clean.Real launcher on Linux (patch copied into a global install),
pi-web -H 0.0.0.0 -p 30198 --no-open: