Deploying Phoenix Application to Heroku with SSL a

2019-07-27 13:54发布

问题:

Just recently deployed an Phoenix Application that runs just fine on the localhost.

The domain name is something.ai and I would like to make anyone trying to use the www version to be redirected to the non-www version.

All the DNS is being managed on CloudFlare's free plan.

Worth noting that I'm using https and SSL, everything has been properly configured on Heroku.

For some weird reason I keep getting a "too many redirects" error, although everything seems to be properly set.

回答1:

I was having exactly the same problem. Follow these steps:

  1. under "Page Rules", remove or disable any forwarding rules you might have
  2. if you're using SSL on Heroku, make sure that your cloudflare dns settings are using .herokudns.com
  3. in cloudflare under "DNS", under the "status" column, make sure your clouds are gray and not orange. (you want to only use the cloudflare DNS, not DNS + proxy