question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ng serve --disable-host-check no longer works

See original GitHub issue

Versions

CLI: 1.6.7
node: 8.9.4
npm: 5.6.0
typescript: 2.6.2
OS: Debian 9.3

Repro steps

  • ng serve --host '0.0.0.0' --port 42002 --public-host 'localhost:42002' --disable-host-check
  • Open http://HostnameOfServer:42002 on a different device

Observed behavior

Request host is not whitelist enabled for this server. Please use the --host command-line flag to whitelist a specific host (recommended) or use --enable_host_checking to disable host checking. See the command-line flags help text for more information.

Desired behavior

Site should load successfully.

Mention any other details that might be useful (optional)

This used to work, but I’m not sure of the version at which it stopped working.

--host '0.0.0.0' is needed while running the CLI in Docker because otherwise it dies with:

getaddrinfo ENOTFOUND '0.0.0.0'
Error: getaddrinfo ENOTFOUND '0.0.0.0'
    at errnoException (dns.js:50:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MichaRedMcommented, Jun 15, 2018

using double quotemarks worked for me: --host "0.0.0.0"

0reactions
angular-automatic-lock-bot[bot]commented, Sep 8, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Invalid Host header" when running Angular/cli ...
The --disable-host-check flag works fine if you need to run from Cloud9. I use the following command: ng serve --open --host $IP --port ......
Read more >
ng serve
Option Description Value Type Default Value ‑‑hmr Enable hot module replacement. boolean false ‑‑host Host to listen on. string localhost ‑‑open Opens the url in default...
Read more >
What does disableHostCheck in package.json exactly do?
The webpack dev server checks the host header to see if it aligns with the "allowedHosts" array. If the host is not present,...
Read more >
ng serve - Angular
Builds and serves your app, rebuilding on file changes. ng serve < project > [ options ]. ng serve < project > [...
Read more >
Rework Your Angular Development Workflow
The next step is to get NGINX working with Angular. ... The ng build command is different than ng serve because no development...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found