Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify which domain using ngrok

Tags:

ngrok

I use mamp and I have virtual hosts all on port 8888. For example:

  • site1.dev:8888
  • site2.dev:8888

would point to localhost/site1/, localhost/site2/ etc.

Before using virtual hosts, I would just change my docroot to whatever project I was currently working on and would start ngrok like so

./ngrok http 8888 and it would launch and give me a random generated *.ngrok.io url.

My question is how do I specify the domain now since I am using virtual hosts?

I've tried ./ngrok http site1.dev:8888 and it starts but just serves up mamps webroot.

I am using a free account.

like image 286
Ronnie Avatar asked Feb 01 '16 18:02

Ronnie


People also ask

How do you specify a region in Ngrok?

To do this, first, log in to your ngrok.com dashboard and click "Reserve Address" in the "Reserved TCP Addresses" section. Then use the -remote-addr option when invoking ngrok to bind a tunnel on your reserved TCP address. Make sure the -region you specify matches the region in which you reserved your address.

How do I find my Ngrok URL?

Steps: 1. Just run the ngrok in screen and then detach. 2. Use the python script given by Gerard above to see the URL.

Is Ngrok a DNS?

Ngrok-dns is a plugin of sorts to the ngrok npm package that enables domain features of ngrok which are not available on the free plan. Ngrok-dns will create a TXT record pointing to the new tunnel each time it changes. Further you can generate a fixed URL using the service at https://ngrok-dns.june07.com.


3 Answers

If you prefer a free option, it is possible via:

$ ngrok http -host-header=site1.dev 80

like image 138
demanzonderjas Avatar answered Sep 21 '22 08:09

demanzonderjas


You can use custom domains with this syntax:

ngrok http -hostname=dev.example.com 8000

For reference: https://ngrok.com/docs#custom-domains

But a paid plan is needed.

like image 23
Pamput Avatar answered Sep 20 '22 08:09

Pamput


Works just for paid plan, otherwise not works :(

The correct way to use a custom subdomain name is follow:

ngrok http -subdomain=mycustomsubdomain 80

Will generate:

Forwarding                    http://mycustomsubdomain.ngrok.io -> 127.0.0.1:80
Forwarding                    https://mycustomsubdomain.ngrok.io -> 127.0.0.1:80

More in docs: https://ngrok.com/docs#http-subdomain

like image 20
Jonatas Eduardo Avatar answered Sep 20 '22 08:09

Jonatas Eduardo