-
Notifications
You must be signed in to change notification settings - Fork 12k
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
Access outside localhost #1793
Comments
It wasn't working for me. Doesn't look like a local port/firewall issue since npm's |
Related to this PR: #1475 (comment) |
I do this on each new CLI project, to make
|
@intellix I was thinking it was something about defining the listening interfaces. Thanks, exactly what I need and the original issue can be considered closed. @kylecordes Even when |
Closed as the original issue is resolved. I would not rely on long term support for |
For this that found this on Google, the best way to do this is to edit your package.json file and edit "start" and replace "ng serve" with @intellix amazing solution "ng serve --host 0.0.0.0". Then just start with "npm start". npm start will always be here ;D |
I still can't access it even when running on |
@chrillewoodz remember the |
@ShadowManu it doesn't work for me too. I set up the config correctly, but I can't reach the address (host unreachable) from any of the devices in the same LAN! |
@toioski I (and many more) can help out on the gitter channel, so we don't dirty up the thread. |
First verify your machine IP Address. In my case this is 192.168.0.10. Now only http://192.168.0.10:4200/ will work, localhost not more. |
@osvaldo-github only for complementing your answer is possible to change your hostname looks like a DNS Windows
Linux
|
Since angular cli uses webpack-dev-server, using this |
I have tried all of the above but none of them worked. ** I guess, we are running dev environment (webpack-dev-server) using ng serve which logically should not be accessible to anyone else while in dev. May help: https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a |
@shinde-prasad The issue might be an antivirus or a firewall that blocks access to the intended port. Have you tried with any other http server? lite-server? or http-server? you can use any http server you prefer by following this wiki story |
Yes you're right. next problem I am facing is |
Please see #6173 for for updates to this functionality as dictated by https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a. |
anyone resolved this issue ? we are getting the same error with new webpack - https://github.com/AngularClass/angular-starter#deployment |
I have resolved the issue by adding my ip address as host in ng serve .Since then , all colleagues in my company can access the application using port. "start": "ng serve --sourcemap false --host=100.168.5.135", |
FWIW, running |
As of at least Angular CLI 1.0 you can set these directly in
|
@taurus227 's solution is the ONLY one that worked for me. Remember to replace "0.0.0.0" host with your ip. ng-serve kept saying:
or "localhost" in place of "0.0.0.0" Now that it works, it says:
|
Actually for me it works with 0.0.0.0. That just means any IP address. |
without use ng-cli
after first -- start all parameters for ng-cli as you need it. |
run the command ng serve --host=0.0.0.0 --disable-host-check to disable host check and access with IPAddress |
I wanted to ask about the new angular.json file which replaced the .angular-cli.json. I used to override the host value there, but now i can not find how to override it. Does anyone has run into the same problem? Can you suggest me a solution other than writing host as parameter? |
@sotiris-rafail I think what you are looking for is "dev-server" which has the "host" option. It looks like "host" is not available in the "server" section of the angular.json. References |
For anyone looking on how to solve that with the new
|
I have the same issue and using npm run ng serve --host 0.0.0.0 does not allow it to be accessed on network. Though app is still accessible locally. |
ng serve --host 0.0.0.0 is a security risk isn't it? Angular cli giving warning. I don't think we can use this for production deployment
and with --disableHostCheck
|
@naveedkamran |
@pratapgowda007 You shouldn't be using ng's dev server for production, not sure what you mean |
update to @jyte answer - solution for angular 7 changed to
|
I follow all the possible solution from this page, and I can say I successfully accessed my application outside my localhost, but the problem is when I try to sign in, I cannot log in and I can't see what is the error. Is their any possible solution for this, might I missed something. by the way I am newbie here, hope you guys can support my query, thank you so much |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Linux Ubuntu 16.04 LTS
ng --version
. If there's nothing outputted, please runin a Terminal:
node --version
and paste the result here:angular-cli: 1.0.0-beta.11-webpack.2 (actually latest
master
at the time of this issue)do on your code? etc.
None in particular
more information.
Is there a way to access the app from
ng serve
(eitherdev
orprod
variants) from another LAN device? Thanks.The text was updated successfully, but these errors were encountered: