Skip to content

Defaults to serve the host on 0.0.0.0 instead of localhost - #2820

Closed
lirantal wants to merge 2 commits into
angular:masterfrom
lirantal:master
Closed

Defaults to serve the host on 0.0.0.0 instead of localhost#2820
lirantal wants to merge 2 commits into
angular:masterfrom
lirantal:master

Conversation

@lirantal

Copy link
Copy Markdown

Problem

On cloud9 (c9.io), the online IDE, if you run ng serve it will bind to the localhost/127.0.0.1 by default and the browser can't view the page because it has to bind to an actual public IP to access it (as this is an IDE over the web).

The default doesn't consider the $IP environment variable.

Solution

Defaults to bind on 0.0.0.0 for all available interfaces.
Since the CLI tool is used to serve as a developer productivity tool this shouldn't bring up security concerns.

@grizzm0

grizzm0 commented Oct 21, 2016

Copy link
Copy Markdown
Contributor

I do not think it should run on all interfaces by default as this might expose something you might not want to expose. I'd say leave it as and use --host 0.0.0.0 whenever you need.

@lirantal

Copy link
Copy Markdown
Author

I understand that this might raise some eyebrows, but my own opinion is that you won't be using the angular-cli on anything production system, hence I don't see any issues with listening on all interfaces.

Leaving it up to the maintainers to figure out if they're interested in this or not.
I will argue that if not changing the default to 0.0.0.0, then at least let's change the cli to support reading env variables like HOST, and IP

@grizzm0

grizzm0 commented Oct 21, 2016

Copy link
Copy Markdown
Contributor

You said it yourself. This is not production and thus should not be open to the public. Just create add a script called start or something in your package.json that does "ng serve --host 0.0.0.0".

@nkwood

nkwood commented Oct 21, 2016

Copy link
Copy Markdown

Defaults to bind on 0.0.0.0 for all available interfaces.

In my opinion this is not a very a good thing to do. I think a lot of people would consider that a very wrong, very unexpected, and perhaps dangerous default.

If you want to be binding to some other address without having to type it each time, you can either create a script as the other comments suggest or even use alias to bind your ng command to whatever you want.

@clydin

clydin commented Oct 21, 2016

Copy link
Copy Markdown
Member

This was already discussed at length in a previous PR (which was closed): #1475.

@filipesilva

Copy link
Copy Markdown
Contributor

What @clydin said 💃

@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 10, 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.

6 participants