Closed mrin9 closed 7 years ago
Just tested, it serves from both, the localhost and the public IP. So no need to have that flag, however if someone really like to use it as a local-web-server then there should be a way to serve from only localhost.
Closing this issue
local-web-server binds to 0.0.0.0
by default, therefore it listens all available hostnames (127.0.0.1, localhost, external IPs, hostname, whatever is in /etc/hosts).
However, I like your idea to make this configurable so re-opening. thanks.
I can look into this.
It would also be good practice to bind to localhost only by default (secure defaults). That would require people who want their local webserver to be available outside of their machine to explicitly set ---address 0.0.0.0
.
this is resolved by the --hostname
option in v2 which is in progress and available for preview.. any feedback welcome.
this is resolved by the --hostname option in v2 which is in progress and available for preview https://github.com/lwsjs/local-web-server/tree/next.. any feedback welcome.
Nice! Tested, works as expected.
I would rename to option though, --hostname
is confusing. The socket is
bound to an IP address, not a hostname. Specifying a hostname requires a
DNS lookup, which really makes no sense in this case.
In other tools, this option is usually called --bind
, --listen
or
--address
(with --bind
being the most common).
Also, from a security standpoint, a good habit would be to bind to
localhost
by default, and not expose the server to the outside.
--
echo mailto: NOSPAM !#$.'<>'|sed 's. ..'|tr "<> !#:2" org@fr33z3
hi.. I use hostname
because its value is passed directly to the hostname
option of server.listen.. but i take your point about names that users are more familiar with, i will look into it.
fixed and released in v2.0.0
Is there a way I can bind the server to 0.0.0.0 address with http-server, we do this -a flag
http-server -a 0.0.0.0
with webpack-dev-server we do this with --host flag
webpack-dev-server --host 0.0.0.0
This would be very useful when we deploy it inside containers