0

I am observing a strange behaviour with ngrok on a GCE VM.

I fire up a 'preemptible' VM instance with static external ip, and start ngrok on it normally. I get the URL that maps incoming https request to http on localhost. I am also able to check the tunnel and everything is working perfectly fine. I create a snapshot of the bootable disk attached to this VM. I turn off the VM.

Then I create another GCE VM that has exact same configuration, network settings (with a different static ip of course) etc except that I disable the preemtibility. The bootable disk is also created through the snapshot above, so it is the exact replica of the disk for the preemtible VM above. I start ngrok on this non-preemtible machine. Ngrok doesn't complain anything, it seems to have started a tunnel.

Snapshot of ngrok after starting tunnel on the non-interruptible VM

However, the tunnel doesn't work. No tunnel found

Can anyone point me to possibe causes / directions to investigate?

I already tried following with no success:

  1. Logging into ngrok and using ngrok authtoken <token> before starting the tunnel
  2. rewriting the host header: ngrok http -host-header=rewrite localhost:3000

1 Answer 1

0

I've tried follow your steps on my test project and found no issues.

Please have a look at my steps below:

  1. create VM instance with network tags http-server and https-server:
  2. create firewall rules to allow HTTP/HTTPS incoming connections:
gcloud compute firewall-rules create default-allow-http --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:80 --source-ranges=0.0.0.0/0 --target-tags=http-server

gcloud compute firewall-rules create default-allow-https --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=tcp:443 --source-ranges=0.0.0.0/0 --target-tags=https-server
  1. install ngrok and php:
instance-8:~$ sudo apt update
instance-8:~$ sudo apt install snapd
instance-8:~$ sudo snap install ngrok
instance-8:~$ sudo apt install php7.2-cli
  1. connect ngrok to the account:
instance-8:~$ ngrok authtoken xxxxxxxxxxxxxxxxxxxxxxxgmfHM
  1. start embedded php web-server with a dummy page:
instance-8:~$ php -S localhost:8000
PHP 7.2.24-0ubuntu0.18.04.6 Development Server started at Mon Jul  6 17:19:31 2020
Listening on http://localhost:8000
Document root is /home/username
Press Ctrl-C to quit.
  1. start ngrok:
instance-8:~$ ngrok http -host-header=rewrite localhost:8000
                                                                                                                                                                              
ngrok by @inconshreveable                                                                                                                                     (Ctrl+C to quit)
                                                                                                                                                                              
Session Status                online                                                                                                                                          
Account                       XXX (Plan: Free)                                                                                                                       
Version                       2.3.35                                                                                                                                          
Region                        United States (us)                                                                                                                              
Web Interface                 http://127.0.0.1:4040                                                                                                                           
Forwarding                    http://1537504102c2.ngrok.io -> http://localhost:8000                                                                                           
Forwarding                    https://1537504102c2.ngrok.io -> http://localhost:8000                                                                                          
                                                                                                                                                                              
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                                     
                              2       0       0.03    0.01    0.00    0.00                                                                                                    
                                                                                                                                                                              
HTTP Requests                                                                                                                                                                 
-------------                                                                                                                                                                 
                                                                                                                                                                              
GET /favicon.ico               404 Not Found                                                                                                                                  
GET /                          200 OK       
  1. check connection and it works as expected.
  2. create new VM instance based on snapshot of the existed VM instance:
gcloud compute disks snapshot instance-8 --snapshot-names=snapshot-1 --zone=europe-west3-a --storage-location=europe-west3
gcloud compute disks create instance-10 --size=10 --zone=europe-west3-a --source-snapshot=snapshot-1 --type=pd-standard
gcloud compute instances create instance-10 --zone=europe-west3-a --machine-type=e2-medium --tags=http-server,https-server --disk=name=instance-10,device-name=instance-10,mode=rw,boot=yes,auto-delete=yes --reservation-affinity=any
  1. start embedded php web-server with a dummy page:
instance-10:~$ php -S localhost:8000
PHP 7.2.24-0ubuntu0.18.04.6 Development Server started at Mon Jul  6 17:42:59 2020
Listening on http://localhost:8000
Document root is /home/username
Press Ctrl-C to quit.
  1. start ngrok:
instance-10:~$ ngrok http -host-header=rewrite localhost:8000
Your account 'XXX' is limited to 1 simultaneous ngrok client session.
Active ngrok client sessions in region 'us':
  - ts_1eK49pNAq8zIKDN2ikKdCvVhwHz (35.XXX.153.XXX)

ERR_NGROK_108
  1. stop ngrok at instance-8 and start it at instance-10:
instance-10:~$ ngrok http -host-header=rewrite localhost:8000
ngrok by @inconshreveable                                                                          (Ctrl+C to quit)
                                                                                                                   
Session Status                online                                                                               
Account                       XXX (Plan: Free)                                                            
Version                       2.3.35                                                                               
Region                        United States (us)                                                                   
Web Interface                 http://127.0.0.1:4040                                                                
Forwarding                    http://38c2f5d9f673.ngrok.io -> http://localhost:8000                                
Forwarding                    https://38c2f5d9f673.ngrok.io -> http://localhost:8000                               
                                                                                                                   
Connections                   ttl     opn     rt1     rt5     p50     p90                                          
                              4       0       0.34    0.39    0.00    0.00                                         
                                                                                                                   
HTTP Requests                                                                                                      
-------------                                                                                                      
                                                                                                                   
GET /favicon.ico               404 Not Found                                                                       
GET /                          200 OK                                                                              
  1. check connection and it works as expected.

I was able to reproduce your issue when I checked connection to the shutted down ngrok at instance-8 using old links while ngrok was running at instance-10:

Tunnel 1537504102c2.ngrok.io not found

I've got the same result was when I checked connection to the shutted down ngrok at instance-10 using old links while ngrok was running at instance-8.

I think in your case it could be some issue at the ngrok side and you should contact them via email contact@ngrok.com.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.