3
votes

I'm developing a Node App. I need https for receiving callback URLs from 3rd party Apps. So I added SSL certificate.

ngrok works only with http URL (http://localhost:3000).

I'm using the command ngrok http 3000. But when I access ngrok https URL, I'm getting 502 Bad Gateway error in browser.

How do I make ngrok work with https://localhost:3000 URL.

2
ngrok tls 3000?hlfrmn
@hlfrmn Looks like it's available only with a paid plan. Could you suggest any other alternatives?Anirudh
I tried ngrok before, and then switched to serveo.net, it's free, no installation and you can impose a subdomain so that you never change the url you're using for development, check it outTourki
@Anirudh did you check my answer? Does it work for you?ffeast

2 Answers

0
votes

If you are using for signup or login with google/facebook then I can suggest you another way. You can use

https://tolocalhost.com/

configure how it should redirect a callback to your localhost. This is only for development purposes.

0
votes

ngrok can itself provide https support - this is one of its major use cases (at least for me) so you don't need to create any ssl certificates

Step-by-step guide

Here's a simple testing file:

$ cat t.html 
<body>
    <h1>test</h1>
</body>

Bringing it up a simple http server on localhost:

python -m SimpleHTTPServer 7070

Running ngrok

$ ngrok http 7070

grok by @inconshreveable                                                                                                                                                                   (Ctrl+C to quit)
                                                                                                                                                                                                            
Session Status                online                                                                                                                                                                        
Session Expires               7 hours, 59 minutes                                                                                                                                                           
Update                        update available (version 2.2.8, Ctrl-U to update)                                                                                                                            
Version                       2.2.4                                                                                                                                                                         
Region                        United States (us)                                                                                                                                                            
Web Interface                 http://127.0.0.1:4040                                                                                                                                                         
Forwarding                    http://4580e823.ngrok.io -> localhost:7070                                                                                                                                    
Forwarding                    https://4580e823.ngrok.io -> localhost:7070                                                                                                                                   
                                                                                                                                                                                                            
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                                                                   
                              0       0       0.00    0.00    0.00    0.00          

Checking

curl -D - https://4580e823.ngrok.io/t.html
HTTP/1.0 200 OK
Server: SimpleHTTP/0.6 Python/2.7.10
Date: Tue, 23 Oct 2018 20:03:45 GMT
Content-type: text/html
Content-Length: 33
Last-Modified: Tue, 23 Oct 2018 19:53:09 GMT
Connection: keep-alive

<body>
    <h1>test</h1>
</body>

That's it