← Back to all articles
TutorialsSoftwareMay 24, 2020Arash Farahani

Free SSL with Free Heroku Dynos: Cloudflare to rescue

Published on May 24, 2020
Free SSL with Free Heroku Dynos: Cloudflare to rescue

On Heroku, yourapp.heroku.com is provided with free SSL, but not if you are using your own domain. The bottom line is that Heroku mentions they offer free SSL certificates but that’s really not the case unless you have a Hobby ($7/mo) or Pro plan.

Here we have a better approach to deal with this using Cloudflare. Cloudflare is a CDN (content delivery network). We can Use Cloudflare As Bridge For SSL. I first learned about this from this StackOverflow response which provides a partial solution. Here I learned that we can use step 4, below, to get end to end encryption.

Requirement:

  1. Cloudflare Account
  2. Your Application should not have inbuild SSL redirection (like redirect-ssl) Otherwise, This will result in Too Many Redirect Error

Step 1: Point Your domain to CloudFlare. You basically open an account an enter your domain when prompted. You may be given instructions to change your domain name servers.

Step 2: Add Cname Record of Heroku Server in DNS of Cloudflare. Instructions are here. Here You will get Some SSL Security Issue.

Step 3: Now Change Your SSL/TLS encryption mode to Full

Step 4: In your DNS settings, you’ll want to create a CNAME: yourdomain.com -> yourapp.herokuapp.com.

Just by looking at the options in Cloudflare, you’ll learn that it can also improve site performance and speeds up loading times by using their multiple data centers that are located around the world. The Cloudflare network acts like a giant VPN.

Share this piece
PostLinkedIn

Substack & Newsletter Syndication

Enjoyed this piece? This post is syndicated to Substack and RSS. Subscribe directly or follow the live feed to receive new deep-dives in your inbox.

Follow RSS FeedContact Arash