Localtunnel: Error "Invalid Host Header"

Created on 9 Aug 2018  路  4Comments  路  Source: localtunnel/localtunnel

I've installed localtunnel on my mac and received a URL after running lt --port 8081. I get the error: "Invalid Host Header". I didn't add a subdomain because I'm not sure where to write that command... is it a separate command or added to the end of lt --port 8081 --subdomain my-intinerary or do I write lt --port 8081/#/my-intinerary alltogether? I've googled for answers, but I'm not sure how to run the commands (_new to command line on Mac_). Thanks.

Most helpful comment

this fixed it for me:
lt --port 3000 --subdomain my-app --local-host localhost

localtunnel's --local-host parameter rewrites the host header similar to ngrok's -host-header parameter:
ngrok http 3000 -host-header="localhost:3000"

All 4 comments

If you are using a webpack dev server either directly or through some other framework like angular/cli you need to tell webpack's dev server to disable host checks. For angular/cli you can disable this check when serving as follows: ng serve --disable-host-check

Hope that helps!

I can confirm that the solution proposed by @c0d3r1010 works.

this fixed it for me:
lt --port 3000 --subdomain my-app --local-host localhost

localtunnel's --local-host parameter rewrites the host header similar to ngrok's -host-header parameter:
ngrok http 3000 -host-header="localhost:3000"

A bit unrelated, but does anyone know how to get hot reload working with localtunnel? I specified host: '0.0.0.0' in dev server config, but it doesn't seem to work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dreki picture dreki  路  21Comments

Scarwolf picture Scarwolf  路  13Comments

nitingupta220 picture nitingupta220  路  5Comments

LewaIngame picture LewaIngame  路  7Comments

amanharitsh123 picture amanharitsh123  路  6Comments