Ngrok gets assigned subdomain

I have a NodeJS script that spins an ngrok instance that runs the ngrok binary.

However, I need to be able to return the automatically generated URL. I can not find anywhere in the documentation on how to do this.

for example, when you start ngrok http 80 it spins, it generates a random unique URL for you every time you start

enter image description here

+5
source share
1 answer

ngrok passes the tunnel information to /api/tunnels . So you can get it like this:

 json=$(curl -s http://127.0.0.1:4040/api/tunnels); node -pe "var data = $json; data.tunnels[0].public_uri" => https://719c933a.ap.ngrok.io 
+1
source

All Articles