Objectives
What I did
essbap.org
through Godaddy. Cloudflare:
rapid
to point to ebcc-rrn.herokuapp.com
rapid.essbap.org
to ebcc-rrn.herokuapp.com
Heroku:
heroku domains:add rapid.essbap.org
=== ebcc-rrn Heroku Domain
ebcc-rrn.herokuapp.com
=== ebcc-rrn Custom Domains
Domain Name DNS Target
---------------- ----------------------
rapid.essbap.org ebcc-rrn.herokuapp.com
$ host rapid.essbap.org
rapid.essbap.org has address 104.27.162.137
rapid.essbap.org has address 104.27.163.137
Cloudflare settings
JUST ADDED:
Running curl
When I run curl
against another Heroku custom domain app that I know works, it looks like:
$ curl -I some.custom_app.com
HTTP/1.1 301 Moved Permanently
Location: https://some.custom_app.com/
# since I'm using force_ssl on Rails, we expect to be directed to https://
$ curl -I https://some.custom_app.com/
HTTP/1.1 200 OK
Similar behaviour for ebcc-rrn.herokuapp.com
(the Herokuapp we want rapid.essbap.org
to be an alias for). A 301 then 200.
But when I run curl
against rapid.essbap.org
, I get:
$ curl -I rapid.essbap.org
HTTP/1.1 301 Moved Permanently
Location: https://rapid.essbap.org/
# since I'm using force_ssl on Rails, we expect to be directed to https://
$ curl -I https://rapid.essbap.org
HTTP/1.1 301 Moved Permanently
Location: https://rapid.essbap.org/
We get a 301 instead of a 200 in the second case. Am not sure why the 301 is being generated. Does not happen in dev or with ebcc-rrn.herokuapp.com
.
What am I missing?
Too Many Redirects If you're receiving the ERR_TOO_MANY_REDIRECTS error when accessing your HTTPS enabled site that is being proxied through Cloudflare, it's likely that you have SSL set to Flexible. This should be set to Full (strict), which will ensure connections to your site are fully encrypted end-to-end.
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.
Heroku DNS uses DNSSEC to authenticate requests to all herokuapp.com and herokudns.com domains. DNSSEC is a security system that gives DNS servers the ability to verify that the information they receive is reliable.
Go to the record editor and two DNS records, one for each host name, pointing to the Heroku SSL endpoint: Add an ALIAS record to point example.com to Heroku. Leave the Name of the record empty and set the Content field to the SSL endpoint example.com.herokudns.com. Add a CNAME record to point www.example.com to Heroku.
Im my case setting Crypto -> SSL Flexible
to Full
did the trick.
I experienced the same issue on a site recently, also using Heroku and Cloudflare and SSL.
In our case, the solution was that we had to set the SSL option in Cloudflare under Crypto > SSL to Flexible
. We had it on Full
, which was causing the site to try to use CloudFlare's SSL certificate. It didn't work with the SSL option set to Off
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With