Skip to content

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

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

Closed
wants to merge 2 commits into from

Conversation

lirantal
Copy link

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
Copy link
Contributor

grizzm0 commented Oct 21, 2016

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
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
Copy link
Contributor

grizzm0 commented Oct 21, 2016

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
Copy link

nkwood commented Oct 21, 2016

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
Copy link
Member

clydin commented Oct 21, 2016

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

@filipesilva
Copy link
Contributor

What @clydin said 💃

@angular-automatic-lock-bot
Copy link

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