且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用SSL和CloudFlare将Phoenix应用程序部署到Heroku“太多重定向”

更新时间:2022-10-20 11:53:14

我有同样的问题。请按照以下步骤操作:


  1. 在页面规则下,删除或禁用任何可能
    的转发规则

  2. 如果您在Heroku上使用SSL,请确保您的cloudflare dns设置正在DNS下的cloud中使用.herokudns.com

  3. 列,确保您的云层是灰色而不是橙色。 (你想只使用
    cloudflare DNS,而不是DNS +代理


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.

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