ngrok icon indicating copy to clipboard operation
ngrok copied to clipboard

How to actually tunnel to https://localhost?

Open lukewlms opened this issue 6 years ago • 12 comments

I upgraded my account, attempted tls and tcp tunnels - nothing has worked.

Creating these types of tunnels is billed in other threads as the only way to tunnel to https://localhost (I need testing with the green check for Stripe PaymentRequest setup); but the URLs ngrok gives me when I use these protocols are not usable in a browser (e.g. tls://...)

How can I use a browser to tunnel to https://localhost:xxx domains? It appears this must be possible given these threads:

https://github.com/inconshreveable/ngrok/issues/194 https://github.com/inconshreveable/ngrok/issues/123

Thanks!

lukewlms avatar Mar 21 '18 21:03 lukewlms

I use ngrok to run a server in local host 3001, using rails servers. My rails server is running in bash and, in another bash, I run the command "ngrok http 3001" And it works. Usualy gives me and url like this: https://e83ca07e.ngrok.io try that, maybe works. "ngrok http YOURHOSTNUMBER"

JooLuiz avatar Apr 04 '18 16:04 JooLuiz

@lukewlms did you ever get this figured out? I'm trying to do the same thing.

brasten avatar Jun 17 '18 20:06 brasten

No :\ got a snarky comment from the dev but not solution.

lukewlms avatar Jun 18 '18 11:06 lukewlms

This would be really nice to have. I'm trying to test the autocert code I've been writing, and it'd be nice if I could use ngrok to tunnel tcp 80 and 443 on the same domain.

emptyflash avatar Jun 24 '18 21:06 emptyflash

This all seems pretty odd. I run Laradock locally and don't even bother setting up nginx to listen on port 80. My sites are not available on anything but https, anywhere, ever. It's 2018 after all. I have no interest in port 80.

Perhaps there's a technical reason why ngrok doesn't appear to support an https localhost? When you access a url such as https://14541v64.ngrok.io, the https cert is supplied by ngrok.io. The traffic is decrypted on their server, and then sent onwards unencrypted to your localhost (albeit encrypted via an SSH tunnel or however they implemented it, I presume).

I wish we could tell ngrok to send our (probably self-signed) certs straight through to the client, and not use their cert at all. Just pass the https-encrypted traffic straight through to our localhost.

jeff-h avatar Nov 22 '18 01:11 jeff-h

@lalo312 — not sure what you're suggesting I should upgrade. I just installed ngrok today, so that would be the latest.

jeff-h avatar Nov 22 '18 04:11 jeff-h

+1, it doesn't seem possible to use a localhost https with ngrok, with the free plan at least 😢

I've gone through other related github issues and tried the suggestions - using IP address, tcp tunnels etc and nothing seems to work. It would be amazing if it did work 😄

ttbarnes avatar Dec 13 '18 13:12 ttbarnes

Will this opportunity ever work?

alkoval avatar Jan 18 '19 11:01 alkoval

This issue can be closed, see this issue

th0mk avatar Sep 16 '19 09:09 th0mk

this issue can not be closed. Basically, the problem is ngrok with tls certs can only forward to http, there is no https option when using tls, rather than http. It's bumkis.

nelsonenzo avatar Oct 26 '19 07:10 nelsonenzo

the same issue with me, so it solved or not ?

pretech86 avatar Feb 23 '20 14:02 pretech86

The way to tunnel https on localhost is:

  1. Setup certificates
  2. Make your server include server.crt and server.key in its headers. E.g. using Uvicorn I did
    uvicorn.run("views:app", host="localhost", port=5000, log_level="info", ssl_keyfile='server.key', ssl_certfile='server.crt')
  3. With your server running on e.g. https://localhost:5000 forward your port as described in Local HTTPS Servers: ngrok http https://localhost:5000
  4. You should now have an ngrok instance using https all on free plan

rSkogeby avatar May 07 '20 10:05 rSkogeby

Thank you for opening this issue! As of April 2016, the ngrok service has permanently moved to https://ngrok.com/. To join the community and file bug reports or feature enhancements for the ngrok agent, please go to https://github.com/ngrok/ngrok.

This repository is no longer actively maintained and will be archived soon to reduce confusion with the latest ngrok versions. We thank you for the continued support of ngrok and look forward to seeing you over at ngrok.com and the ngrok Community Repo.

russorat avatar May 09 '24 19:05 russorat