Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing ngrok web interface on a Vagrant box

I have a Vagrant box I'm using for local development. I'm working on a webhook, which is being called from outside; so I'm thinking of using ngrok.com to proxy requests to my Vagrant environment. I'm new to this ngrok thing.

I'm trying to figure out how to access ngrok's web interface, which is normally at http://127.0.0.1:4040. Of course, that doesn't work from my browser, because it's outside of the Vagrant box, so its localhost is not the Vagrant's localhost.

I (think I) have the Vagrant's IP address. I found it in a config.yaml file (yes, with an a), under vm: network: private_network: 192.168.nnn.nnn

Thanks for your help.

like image 253
NotoriousWebmaster Avatar asked Oct 27 '15 01:10

NotoriousWebmaster


People also ask

What is Web interface in Ngrok?

ngrok's local web interface has a dedicated status page that shows configuration and metrics information about the running ngrok process. You can access it at http://localhost:4040/status.

Does Ngrok work on virtual machine?

Completed. to develop api server for App, you can easily use api server on the virtual machine(Guest System) in the local machine(Host System) by ngrok .

How do I change my localhost port for Ngrok?

Download and install ngrok to make your local server accessible remotely. $> cd /path/to/your-project-folder $> ngrok 8080 Copy the public URL ngrok gives you and try running it through PageSpeed Insights!


2 Answers

When trying to access a site in a VM, put ngrok in the host machine, and invoke it with:

ngrok http -host-header=rewrite mydomain.com:80

You'll need to access your site (in host machine's browser) with:

http://123456.ngrok.io

But it will rewrite it to mydomain.com.

And you'll be able to access your ngrok dashboard (in host machine's browser) with:

http://127.0.0.1:4040

Docs at https://ngrok.com/docs#host-header. Best of luck!

like image 121
NotoriousWebmaster Avatar answered Oct 03 '22 02:10

NotoriousWebmaster


Your problem is this one: https://github.com/inconshreveable/ngrok/issues/153

You have to create a config file with the following content:

web_addr: 0.0.0.0:4040

And then run ngrok as this:

ngrok http 3000 -config=/path/to/ngrok.conf

Now you can access the web interface from your browser using the following addresses: http://vagrantip:4040 or http://vagranthostname:4040

For example, http://192.168.33.34:4040 or http://site.dev:4040 if your /etc/hosts is configured in this way

More info on ngrok config file is here: https://ngrok.com/docs#config

like image 43
Evandro Saroka Avatar answered Oct 03 '22 03:10

Evandro Saroka