Invalid Host header after updating to 1.0.1
- [x ] bug report -> please search issues before submitting
- [ ] feature request
Versions.
1.0.1
Repro steps.
update to 1.0.1 ng serve browser will read: Invalid Host header, and do nothing
The log given by the failure.
none
Desired functionality.
serve my application.
Mention any other details that might be useful.
Downgrading to 1.0.0 fixed the issue. (BTW, running on ubuntu and debian, same issue)
@rahianeja @flackjap Did you manage to solve your problem? I'm having the same thing. I can access my app with the --disable-host-check from the internet but I get the "Error: Could not connect to REST server. Please check your configuration details". It works locally with no issues.
Where do you get that error from? Angular CLI? Browser? Something else?
@flackjap Sorry for being unspecific. I'm following the tutorial to setup a hyperledger app over here. Part of that is generating a REST server and an Angular Skeleton application with Yeoman ontop. I have addedd the --disable-host-check which solves the problem of "Invalid host header" but I'm now running in to an error in the browser when I try to interact with the REST API from the app. The rest API works by itself and the interaction works when I use it on the local machine (localhost:4200).

@flackjap @rahianeja I solved it. Was an easy fix. I needed to edit the file: my-app/src/app/configuration.ts. The line
public ApiIP: string = "localhost";
Change that to your external IP.
@kimfrithiof I am having the same issue as you however changing the line
public ApiIP: string = "localhost";
to my external IP still did not work. The error reappeared when I went to post the asset
I don't know what you guys are trying to do, but it seems that it has nothing to do with Angular CLI. You have some API routing problems as I can see, and you are probably just trying to hit the same URL where you got your Angular app served, which, obviously can't handle your API requests as it's not supposed to.
This situation has happened to me while trying to have a docker apache httpd work as a reverse proxy to my localhost nodejs .
The message popped up in my browser saying that the hostname was invalid, but not clarifying what hostname was being used. After modefying the Server.js to do a console.log of the invalid name it was clear that the invalid name was: webpack: Compiled successfully. hostname being rejeted is: docker.for.mac.localhost
A hurdle for development. Normally, this situation would not apply on a productive environment, since every code may be running on a container with a proper hostname. But when in your local development machine you might want to run some code from your main HOST OS - you may end up with docker machines being allowed to connect to your main operating system. In Mac you get that very convenient hostname for this effect.
I am going to modify the if(hostname === "127.0.0.1" || hostname === "localhost") return true;
To contain the docker Mac localhost.
Until this gets resolved you can just change the following line in node_modules/webpack-dev-server/lib/Server.js (line 402):
if(this.disableHostCheck) return true;change to
return true;
this saved me after many hours of surfing for the solution
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.