Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make hostname in next start match hostname the server is listening on #5417

Closed
wants to merge 2 commits into from
Closed

Make hostname in next start match hostname the server is listening on #5417

wants to merge 2 commits into from

Conversation

Tenzer
Copy link

@Tenzer Tenzer commented Oct 9, 2018

This is only a problem when using the default value for the hostname, as that
will make the server output > Ready on http://localhost:3000 to the console
while the server actually is listening on all IPv4 and IPv6 addresses, as
that's the default for the Node.js HTTP server when no hostname is provided.

Tenzer and others added 2 commits October 9, 2018 12:15
This is only a problem when using the default value for the hostname, as that
will make the server output `> Ready on http://localhost:3000` to the console
while the server actually is listening on all IPv4 and IPv6 addresses, as
that's the default for the Node.js HTTP server when no hostname is provided.
@iamstarkov
Copy link

I don't understand why is this needed

@Tenzer
Copy link
Author

Tenzer commented Nov 11, 2018

It's in order to make the output of the next start command match what it's actually doing.

If I start a server with the default options, I get this output:

$ next start
> Ready on http://localhost:3000

So, based on that I would expect the server to be listening on localhost:3000, or 127.0.0.1:3000, but when I check with netstat it actually listens on all IP addresses, not just localhost:

$ netstat -an | grep .3000
tcp46      0      0  *.3000                 *.*                    LISTEN

If I however specify 'localhost' as the hostname to listen on, like this:

$ next start --hostname localhost
> Ready on http://localhost:3000

then the server correctly listens on the localhost IP address, 127.0.0.1:

$ netstat -an | grep .3000
tcp4       0      0  127.0.0.1.3000         *.*                    LISTEN

This PR changes the default listen address so it matches what the command outputs.

@timneutkens
Copy link
Member

I don't think we should change the default as it can be breaking for a segment of users. The output is just a help for the user to easily open the running server.

@iamstarkov
Copy link

@timneutkens should it be closed then?

@timneutkens
Copy link
Member

Yeah let's close this PR.

Thanks for taking the time to create a PR though 🙏 🙌

@Tenzer Tenzer deleted the fix-next-start-hostname branch November 14, 2018 10:50
@lock lock bot locked as resolved and limited conversation to collaborators Nov 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants