Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using SSL Cert for ngrok dev environment

I am working to setup my application to watch calendar events through Google's Calendar API. In doing so I must setup a "Push" endpoint on my server that has a valid SSL certificate (not self-signed).

My production environment is running on Heroku so setting up an SSL cert was easy using Expidited SSL. I have two CNames setup in GoDaddy, one for my production application and one for my development environment tunneled through ngrok. I'm using the paid ngrok feature of white labeled domain tunneling (dev.mydomain.com).

Host           Points To

www            saga-1234.herokussl.com
dev            ngrok.com

The problem is that my ssl certificate is recognized when you hit the production application (www.mydomain.com), but it uses ngrok's certificate when you visit the development application (dev.mydomain.com).

enter image description here

How can I setup my ngrok tunnel to use my ssl certificate?

like image 322
Jeff Miller Avatar asked May 25 '14 05:05

Jeff Miller


People also ask

Does Ngrok use https?

ngrok TLS tunnels make no assumptions about the underlying protocol being transported. All examples in this documentation use HTTPS because it is the most common use case, but you can run run any TLS-wrapped protocol over a TLS tunnel (e.g. IMAPS, SMTPS, SIPS, SRTP, etc) without any changes.


1 Answers

Ngrok's white labeled domain does not support HTTPS if you are using your own domain. Simply because it serves it's own certificate, where you need to serve your domain's. That's why you are getting certificate mismatch issue.

Here's what you could do to watch calendar events on your dev machine:

  1. Point ngrok.mydomain.com to another server, let's say a new EC2 micro instance
  2. Point wildcard CNAME to ngrok.mydomain.com
  3. Compile ngrok server and client to use your certificate (rather than ngrok.com)
  4. Run the ngroku-server on EC2 instance
  5. On your dev machine config the client to use ngrok.mydomain.com instead of ngroku.com
  6. Run ngrok -subdomain=dev 80

Your local dev machine's 80 port should be accessible via https://dev.mydomain.com

This is really cool and is very helpful when debugging Google's webhooks, which require valid HTTPS and a verified root domain name.

Another interesting trick is to use CloudFlare's universal SSL to have a valid https://dev-machine.mydomain.com pointing to your dev machine without purchasing a certificate. The steps are exactly the same except that you need to issue your own certificate for ngrok client-server communications and use CloudFlare's Flex SSL for dev-machine.yourdomain.com.

like image 140
Vilius Paulauskas Avatar answered Oct 03 '22 04:10

Vilius Paulauskas