Reputation: 1686
I would like to use ngrok to make my local development available to external apis that need to use webhooks with it but when I run ngrok on port 4200, Angular gives me Invalid Host Header
when I try to access the site from the ngrok link. Does anyone know how I can access an angular ng serve from outside localhost with ngrok?
Thanks
Upvotes: 9
Views: 15878
Reputation: 1197
Small reminder, an issue I was facing myself. For me, the solution of Diego Santa Cruz Mendezú worked. But it only worked for me in my Google Chrome 'Incognito' browser because then all my extensions are disabled! Just a reminder that a console error can also be an extension error and therefore the site might not show up (correctly), which was the case at my side.
Upvotes: 0
Reputation: 865
It's working, but it throw error Invalid Host/Origin header
+ [WDS] Disconnected!
in console...
Upvotes: 0
Reputation: 4671
This works with single line code:
ngrok http 4200 -host-header="localhost:4200"
Upvotes: 6
Reputation: 471
I tried running the ng serve on prod environment by disabling the host check option and it worked,
Cmd1:
ng serve --prod --host 0.0.0.0 --disable-host-check
.
and tried using ngrok with the following solution
Cmd2:
ngrok http 4200 -host-header="localhost:4200"
Upvotes: 24
Reputation: 576
I managed to get past the invalid host header, if you do ng serve --disable-host-check
you won't get that error and it should run in ngrok.
edit: I've been trying to use ngrok for a remote selenium grid but can't get that to work if anyone has any ideas let me know
Upvotes: 28