Can't connect to https://localhost with ngrok (using TLS / SSL)
Asked Answered
H

1

8

I've seen multiple threads on this but still can't get up and running.

I've tried TLS and TCP connections, but the main issue is that browsers cannot understand these URLs (e.g. tls://2456xxxx.ngrok.io).

Once I set up a TLS or TCP connection to https://localhost, how can I actually connect through a browser?

(I need to test Stripe's PaymentRequest feature which requires a localhost connection with a green check.)

Threads on this issue that don't seem to answer this question: https://github.com/inconshreveable/ngrok/issues/194 https://github.com/inconshreveable/ngrok/issues/123

Helicopter answered 21/3, 2018 at 21:23 Comment(0)
H
2

I got this to work by turning off https on my local server. If you run a plain http local server on 8080 and then run ./ngrok http 8080 you will be given a signed https ngrok URL that will tunnel to your http server.

Haber answered 16/6, 2018 at 18:19 Comment(5)
Unfortunately the whole reason I need this is that Stripe local development with ApplePay requires https. Thanks though!Helicopter
@LukeWilliams Stripe local development with Apple Pay is exactly what I was trying to do as well, and I succeeded using this method. All you need to do is to turn off https on your local server, then navigate to the https version of the ngrok tunnel URL. The connection between your browser and the ngrok URL is https, so Apple Pay etc. will work. Ngrok handles the secure connection between your local server and the Ngrok tunnel endpoint. Try it!Haber
Ohhhhhh whoa... mind blown! That would have saved some time. Will try.Helicopter
@jweob"Ngrok handles the secure connection between your local server and the Ngrok tunnel endpoint." -- There won't be SSL between ngrok and your local server if your local server runs HTTP. Just to clarify. If you use a self-signed cert on your local host (which you probably do) then this connection would be encrypted but still insecure because of the invalid cert.Washer
Disabling HTTPS should no longer necessary. Ngrok supports HTTPS since a few months ago, see this commentMelson

© 2022 - 2024 — McMap. All rights reserved.