Skip to content

"Invalid Host Header" persists with cli > 1.0.0 with Docker container on Windows 7 #7037

Closed
@johanchouquet

Description

@johanchouquet

Bug Report or Feature Request (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.0
node: 7.9.0
os: linux x64
@angular/animations: 4.3.0
@angular/common: 4.3.0
@angular/compiler: 4.3.0
@angular/core: 4.3.0
@angular/forms: 4.3.0
@angular/http: 4.3.0
@angular/platform-browser: 4.3.0
@angular/platform-browser-dynamic: 4.3.0
@angular/router: 4.3.0
@angular/material: 2.0.0-beta.8
@angular/cli: 1.0.0
@angular/compiler-cli: 4.3.0
@angular/language-service: 4.3.0
@angular/cdk: 2.0.0-beta.8

Repro steps.

The steps are not simple, as it is also linked to the used environment.

Until Angular-Cli 1.0.0, it was possible to launch ng serve -H 0.0.0.0 , which worked fine for me in a container development environment. The thing is that I'm on Windows 7, using Docker Toolbox to have my containers running under Linux.
From there, Angular-Cli > v1.0.0 uses an updated version of Webpack (> 2.4.3 if I remember well). And with that, the -H 0.0.0.0 doesn't work anymore.
I obtained Invalid Host Header.

I've seen a lot of problems, and some solutions around that. But none of these are actually working for me.
I tried with --disable-host-check option, but then, it was live-reload that wasn't working. I had plenty of : [WDS] Disconnected! GET http://localhost:4200/sockjs-node/info?t=1480728685812 net::ERR_CONNECTION_REFUSED messages.
See #3361 for more details.

I also tried some tests with --live-reload-client set to the IP address (with protocol://IP:port), in all different manners (with and without --disable-host-check).
I even tried to hack the Cli by setting a new Docker Image with an new serve.js file in node_modules/@angular/cli/tasks to set the live-reload host.

The log given by the failure.

But still, same result : I obtained Invalid Request Header.

Desired functionality.

What would like to see implemented?

Developers should still be able to develop the way they used to, by updating their tools for development. Obviously, this is not just related Angular-Cli, but is also related with Webpack & live-reload, but I believe that I am not the only one who was impacted by this change.

I'd like to be able to use the same workflow as I was used to, except for some modifications. But for now, it just doesn't work. I'm stuck with v1.0.0 of Angular-cli.

What is the usecase?

Allow developers to develop under Windows 7/10 + with Docker containers seamlessly, setting the correct options in the Cli or Webpack.

Mention any other details that might be useful.

I saw that a higher version of Webpack exposes an array of AllowedHosts. Maybe this could be a true solution to this problem, allowing developers to set wildcards of allowed hosts (ex: 192.168..). But still, it would have to be developed in the Cli (if not already done).

Sorry if you consider that it's not a real bug, but it's a real problem for me and others as I've read quite some issues about that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthelp wantedneeds: investigationRequires some digging to determine if action is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions