Skip to content

Angular 9 --disableHostCheck flag has no effect when --host is passed (or --configuration) #20951

Closed
@ghost

Description

Created a new project with Angular CLI 9.1.15 (but also tested with version 11.2.13, no difference at all):

$ npm run start -- --host 0.0.0.0 

> [email protected] start /home/rkrisztian/tmp/angular-nine-template
> ng serve "--host" "0.0.0.0"

WARNING: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.

Binding this server to an open connection can result in compromising your application or
computer. Using a different host than the one passed to the "--host" flag might result in
websocket connection issues. You might need to use "--disableHostCheck" if that's the
case.
(...)
$ npm run start -- --host 0.0.0.0 --disableHostCheck true 

> [email protected] start /home/rkrisztian/tmp/angular-nine-template
> ng serve "--host" "0.0.0.0" "--disableHostCheck" "true"

WARNING: This is a simple server for use in testing or debugging Angular applications
locally. It hasn't been reviewed for security issues.

Binding this server to an open connection can result in compromising your application or
computer. Using a different host than the one passed to the "--host" flag might result in
websocket connection issues. You might need to use "--disableHostCheck" if that's the
case.
WARNING: Running a server with --disable-host-check is a security risk. See https://medium.com/webpack/webpack-dev-server-middleware-security-issues-1489d950874a for more information.
(...)

Why does it still warn me?

I can't do anything about it, becuase if I move the host parameter to angular.json, and use --configuration to specify the configuration I want to use, the problem is still back, and --disableHostCheck cannot do anything about it!

Please help, this is really frustrating. Although right now we are on Angular version 9, we do plan to upgrade all the way up to 11 (maybe to 12 later), but it takes time...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions