Identifying a local host on the Internet through tunneling (using ngrok): HTTP error 400: invalid request; wrong address

In previous versions of the question, there is the following: Overview of a website with an IP address, not a local host , which pretty much describes what I have done so far. I have a local IP address. Then I found ngrok, and apparently I don't need to connect via IP.




What I'm trying to do is expose my site running on a local hosting on the Internet. I found a tool that will do this: ngrok.

Running the website in visual studio, the website is running on localhost / port #. I run the command "ngrok http port #" on the command line. Everything seems to start well. I am creating a couple URLs and the ngrok check url (localhost: 4040) is working.

The only problem is that when I go to the generated URLs, I get an HTTP 400 error: invalid host id. This is a different error than starting "ngrok http wrongport #", which is an error not found by the host ... so I think something good is happening. I just can't say that ...

Is there any step that I am missing when exposing my site to the Internet through tunneling? If there is, I cannot find it in the ngrok documentation.

+141
asp.net-web-api visual-studio-2012 iis-express ngrok
May 29 '15 at 17:09
source share
5 answers

Fix this problem with ngrok. According to the incontrovertible, some applications get angry when they see a host header other than expected.

Running the following command should solve the problem:

ngrok http [port] -host-header="localhost:[port]" 
+386
Jun 02 '15 at 16:16
source

This did not work for me. you can do the following:

For IIS Express

In VS 2015: Go to the .vs\config\applicationhost.config folder in your project

In VS 2013 and earlier: Go to %USERPROFILE%\My Documents\IISExpress\config\applicationhost.config

Find a binding that says:

 <binding protocol="http" bindingInformation="*:5219:localhost" /> 

For me it was a project launched on port 5219

change it to

  <binding protocol="http" bindingInformation="*:5219:" /> 

IIS Express will now accept all incoming connections on this port.

Disadvantage: you need to run IIS Express as an administrator.

or you can rewrite the node header in Ngrok:

 ngrok.exe http -host-header=rewrite localhost:5219 
+32
Nov 24 '15 at 3:02
source

The following command will fix the problem

 ngrok http -host-header=localhost 8080 
+25
Aug 07 '17 at 10:42 on
source

The easiest thing for me was to use iisexpress-proxy + ngrok.

First, I install iisexpress-proxy globally using npm.

npm install -g iisexpress-proxy

Then I proxy my local host with it. Say, for example, my site runs on 3003 .

iisexpress-proxy 3003 to 12345 where 12345 is the new http port, iisexpress-proxy 3003 to 12345 which I want to connect to.

Then I can run ngrok on it.

./ngrok.exe http 12345

It just works! 😃

But I think this only works with http . Right now I am not using https for testing, but even if it works, it usually does a lot of work, as always.

0
Apr 09 '19 at 19:22
source

Steps.

  1. Run the command on your console from the ngrok.exe directory. ngrok http port i.e. http 80 ngrok https://www.screencast.com/t/oyuEPlR6Z Set

  2. Ngrok URL for your application.

This will create a tunnel for your application.

Thank you

-5
May 11 '18 at 12:17
source



All Articles