Open (-o) option now defaults to http://0.0.0.0
See original GitHub issueSteps to reproduce the issue, if applicable. Include the actual command and output and/or stack trace.
Run the following simple command:
http-server -o some-page.htm
What did you expect to happen? I expect http-server to open some-page.htm automatically in my browser using a valid local address (http://127.0.0.1/some-page.htm)
What actually happened? My browser opened to an empty page on http://0.0.0.0:8080/some-page.htm
Tell us about your environment
- exact http-server version:: 13.0.1
- Node version:: 14.15.2
- Platform:: Win 10
Other information (related issues, suggestions for a fix, etc):
This issue just popped up when I updated from v0.12.3 to 13.0.1 and it is caused by issue https://github.com/http-party/http-server/issues/615 and pull https://github.com/http-party/http-server/pull/642. After some research, I realized I can fix it by adding the address to use -a
to my command line arguments like so…
http-server -o some-page.htm -a http://127.0.0.1
But the -o
option previously worked without specifying the address. Shouldn’t the server still default to 127.0.1 if no address is specified? As far as I can tell, all that pull request was supposed to do was to allow users to set the address to 0.0.0.0, not make it as the new default. But if this was intentional, perhaps you should note in your documentation that the -o
option should now be used with the -a
option.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:9 (3 by maintainers)
Top GitHub Comments
Replicated on http-server 13.0.0, Node 16.9.0 and Win 10.
Reading the README it is clear that 0.0.0.0 is the default, but much like OP I recommend that 127.0.0.1 is used as the default even if the pull request to allow 0.0.0.0 to be used remains. It is far more intuitive.
I am using
-a 127.0.0.1
without the http:// and everything works fine for both http and https.Wonderful! This will be fixed in a patch version to be released later today