Connect with the Cloudflare Community

Configure Cloudflare and Heroku over HTTPS

You can set up your Heroku app in Cloudflare using a secure connection. This process requires configuring two CNAME DNS records and enabling Cloudflare SSL.

Overview

Heroku is a cloud PaaS that supports several pre-configured programming languages. Heroku deals with all your infrastructure so you can focus on your application without having to work at the command line.

This article describes how to configure Heroku with Cloudflare to serve your traffic over HTTPS. For this article, we'll assume that you already have an active domain on Cloudflare, as well as a running Heroku app.

Step 2 - Add a subdomain in Cloudflare DNS

Step 2a - Add a subdomain

To start, log in to your Cloudflare account, navigate to the DNS app and add a 'www' CNAME record that points to the custom domain (also known as DNS target) that you obtained in Step 1 above for your subdomain.

Step 2b - Add your root domain

Adding a root or apex domain on Heroku also requires using a CNAME record pointed from your root. You cannot use A records on Heroku because no IP addresses are exposed for Heroku users to use.