gpt4 book ai didi

ruby-on-rails - Heroku 托管的 RoR 站点与 CloudFlare ssl 不工作

转载 作者:太空宇宙 更新时间:2023-11-03 13:07:20 24 4
gpt4 key购买 nike

我非常需要帮助!我在 Heroku 上托管了一个 Ruby on Rails 站点。该网站与 heroku 应用程序地址配合良好。我正在尝试使用 ssl 使我的自定义 url 正常工作。我的 url 已在 GoDaddy 注册,我为 ssl 创建了一个 CloudFlare 帐户,而无需支付 Heroku 收取的 20 美元/月费用。

我在 heroku 中添加了域名。我在 CloudFlare DNS 中创建了 cname 和 cname 扁平化,并从 godaddy 更改了名称服务器。我有一个完整的 ssl 证书,CloudFlare 将其显示为事件证书。但是,当我尝试访问该网站时,出现以下错误:

SSL 连接错误:无法与服务器建立安全连接。这可能是服务器的问题,或者它可能需要您没有的客户端身份验证证书。

我已经通过 CloudFlare 上的常见问题解答但没有成功。谁能帮我解决我可能做错的地方?

谢谢!

============================================= ===

  • SSLv3、TLS 握手、客户端问候 (1):
  • SSLv3、TLS 警报、服务器问候 (2):
  • 错误:14077438:SSL 例程:SSL23_GET_SERVER_HELLO:tlsv1 警报内部错误
  • 关闭连接 0 curl :(35)错误:14077438:SSL例程:SSL23_GET_SERVER_HELLO:tlsv1警报内部错误

最佳答案

有点晚了,但这对我有用:

第一步

Make a Cloudflare account, and add the bought domain to cloudflare and transfer the DNS settings'

第 2 步

Add your domain to your heroku panel. On the heroku site, log in, go to 'settings' press 'add custom domain' - Add both your domain 'www.example.com' and your root domain 'example.com'

第 3 步

If you haven't changed your nameservers on your initial domain provider to point to the cloudflare nameservers, please do so now. You can find the cloudflare nameservers which are assigned to you on your cloudflare panel under 'DNS' -> 'cloudflare name servers'

第四步

Go to 'DNS' on your cloudflare account and remove all records (A,
CNAME, ALIAS,TXT etc..).
Now add a CNAME record. The name should be your site 'www.example.com' (with www) and it should point to your heroku app example-example.herokuapp.com

第 5 步

Create a Google Business account. And follow along with the verification steps given by Google.

第 6 步

Log in at admin.google.com and go to 'domains'. If you can't see 'domains' click on 'more elements'. Now click on 'change redirect' and make your root domain 'example.com' redirect to 'www.example.com'.

第七步

Go to your cloudflare panel and go to 'DNS', now add 4 'A' Records. - All 4 of the 'A' records should have the name of your root domain 'example.com' and they should point to 216.239.32.21, 216.239.34.21, 216.239.36.21, 216.239.38.21, which are the ip addresses given by Google to make the redirects work.

边注

On cloudflare, the 'A' record statuses need to be set to 'DNS Only' and the 'CNAME' record statuses to 'DNS and HTTP proxy(CDN)'

第 8 步

On your rails app go to production.rb and make sure config.action_mailer.default_url_options = { host:
'https://example-example.herokuapp.com' }
is set to config.action_mailer.default_url_options = { host:
'example-example.herokuapp.com' }
so simply remove the 'https://'.

And also config.force_ssl should be false

After you have done that make sure you upload the result to heroku.

第 9 步

At cloudflare go to 'crypto' and make sure SSL is set to 'Flexible', if not please change it now, it might take a few moments before the changes are completed by cloudflare.

恭喜!!!!!!!!!!!!

At this point your site should be up and running and working for both your root domain aswell as for your full domain.

额外

ONLY IF YOU WANT BUSINESS EMAILS BY GMAIL (eg. info@example.com)

On cloudflare go to 'DNS' and add 5 'MX' Records.

  1. example.com(your root domain) - point to aspmx.l.google.com with priority 1
  2. example.com(your root domain) - point to alt1.aspmx.l.google.com with priority 5
  3. example.com(your root domain) - point to alt2.aspmx.l.google.com with priority 5
  4. example.com(your root domain) - point to alt3.aspmx.l.google.com with priority 10
  5. example.com(your root domain) - point to alt4.aspmx.l.google.com with priority 10

Note: The TTL should be set to '1 hour' for all 'MX' records.

现在走出去,做最好的自己!!

关于ruby-on-rails - Heroku 托管的 RoR 站点与 CloudFlare ssl 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33240819/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com