I've been working on a simple app, which is hosted on Heroku here: https://enigmatic-hollows-2702.herokuapp.com/ - the page loads just fine in a browser and all is well. The issue I encounter is when I try to use the root domain "lunchnexus.com" with the app. These are the steps I've taken:
- Updated Hoover (registrar) Name Server records with CloudFlare-supplied Name Servers
- Added lunchnexus.com to CloudFlare, created a CNAME record that directs lunchnexus.com to "enigmatic-hollows-2702.herokuapp.com"
- Added lunchnexus.com to my app within the Heroku login panel.
The problem I now face is that this creates a redirect loop - somehow (I suspect it may have something to do with SSL, as CloudFlare support somewhat pointed me in this direction.) I'm not sure where this is even set.
I've tried enabling and disabling configure.force_ssl = true / false in production.rb, but it makes no difference. I've tried toggling SSL on and off within CloudFlare, but that also makes no difference.
It feels like the issue is something to do with Cloudflare - since the app loads and works just fine when it uses the *.herokuapp.com URL, but I'm at my wit's end, and CloudFlare's support isn't really helpful.
Any ideas what is causing this redirect loop?
Generally a redirect loop happens when there is a conflicting redirect on your server and/or any PageRules you have created.
A fairly common issue we see is the customer doing something like redirecting root to www, then they have another redirect saying send www to root.
I personally didn't get any errors visiting the site over https://, so please do let support know if you still have any issues (the specific urls the error is appearing on (if it happens again) would be very helpful).