Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngrok.disconnect not closing http tunnel (only https) #54

Closed
nojiek opened this issue May 18, 2016 · 4 comments
Closed

ngrok.disconnect not closing http tunnel (only https) #54

nojiek opened this issue May 18, 2016 · 4 comments

Comments

@nojiek
Copy link

nojiek commented May 18, 2016

When two tunnels are opened simultaneously (bind_tls: both (this is default)), ngrok fails to close both tunnels when using the disconnect command.

Steps to Reproduce:

ngrok.connect(bind_tls: 'both', port: currentPort), function((err, url) {
     console.log("Error Message: " + err);
     console.log('Ngrok URL: ' + url);
     console.log('Port: ' + currentPort);
}

Results in:
Error Message: null
Ngrok URL: https://030927d2.ngrok.io
Port: 3599

This opens TWO tunnels: one at http and one at https

//Kills the ngrok tunnel
ngrok.disconnect(killUrl, function () {
    console.log('URL: ' + killUrl + ' has been killed.');
});

Results:
URL: https://030927d2.ngrok.io has been killed.
{ [Error: socket hang up] code: 'ECONNRESET' }
screen shot 2016-05-18 at 5 46 10 pm

Note that the http tunnel remains open.

@bubenshchykov
Copy link
Owner

bubenshchykov commented May 21, 2016

hey @nojiek, great catch! :)

as a possible workaround, you can close all tunnels with ngrok.kill() - it shots down the whole ngrok process.. and you can ngrok.connect after it again

@vinceis1337
Copy link

Hello @bubenshchykov - I work with @nojiek and we have a workaround. We just wanted to let you know about the problem. Thanks!

@nojiek
Copy link
Author

nojiek commented May 23, 2016

@bubenshchykov Thanks! Our work around is to just to not use "both" for now.

@bubenshchykov
Copy link
Owner

bubenshchykov commented Jun 14, 2016

fixed and covered by test

describe('disconnecting from ngrok', function () {
;)

if you create default bind_tls=true tunnel (two tunnels) and get let's say https://123.ngrok.io - then you can

  • either close both tunnels in two calls: ngrok.disconnect('https://123.ngrok.io'); ngrok.disconnect('http://123.ngrok.io');
  • or close all tunells by ngrok.disconnect(); - it now tracks and closes http tunnel too
  • or kill entire process by ngrok.kill();

PS what we can also do is to make bind_tls=false by default.. because it's a bit confusing and requires some reading of ngrok docs :) or we can kill both tunnels even if you just ask to kill one ngrok.disconnect('https://123.ngrok.io'); - but that might not be what all devs want

so i'll leave it as it is for now, and see how it goes :)
https://github.com/bubenshchykov/ngrok#disconnect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants