Reputation: 1820
I'm on a Mac and I've got an Angular app running locally on this url:
http://localhost:{port}/myPage.html
Now I've got a Windows HVD and I'm trying to access that same site so I substitute localhost with my IP but all the files it tries to load comes back with this error:
Invalid host header
So, this happens for all bundled files. Here's the request that returns the invalid host header error:
Request URL: http://{myIp}:{port}/myBundledFile.js
My build script runs a server that I have configured (based off web pack) and I'm guessing that might be the problem:
"concurrently \"ng serve -c es5 --host=0.0.0.0\" \"npm run my-dummy-server\""
I guess that I don't know exactly what might be causing the problem because I should be easily able to hit my HOST machine from my HVD.
Upvotes: 0
Views: 191
Reputation: 12021
try this: add --disable-host-check param
"concurrently \"ng serve -c es5 --host=0.0.0.0 --disable-host-check\" \"npm run demo-server\""
by default webpack server doesn't allow connections from other hosts as it could be a security issue
Upvotes: 2