Using SSL Cert for ngrok dev environment

google-api, heroku, ngrok, ssl-certificate

Solution

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:

- Point ngrok.mydomain.com to another server, let's say a new EC2 micro instance

- Point wildcard CNAME to ngrok.mydomain.com

- Compile ngrok server and client to use your certificate (rather than ngrok.com)

- Run the ngroku-server on EC2 instance

- On your dev machine config the client to use ngrok.mydomain.com instead of ngroku.com

- 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.

Problem

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). How can I setup my ngrok tunnel to use my ssl certificate?

Original source