ruby-on-rails - 如何阻止谷歌搜索链接到 https?

标签 ruby-on-rails ssl heroku dns search-engine

当我通过 Google 搜索结果找到我的网站时,它正在使用:

https://www.example.com

由于我还没有有效的 SSL 证书,浏览器中会出现一条警告 --

"Your connection is not private"

我希望 Google 使用 http://example.com 而不是 https 链接到我的网站。我的其他非 SSL 网络应用没有这个问题。

我可以采取什么步骤来解决这个问题?

最佳答案

仔细检查您没有在设置中强制使用 SSL

#config/environments/production.rb
# If this is set to true, change it to false
config.force_ssl = false

还要确保您没有使用 https://连接链接到任何外部资源,而是使用协议(protocol)中立的//代替。在我的一个使用 DataTables 的应用程序中查看此片段中的 stylesheet_link_tag 行和注释堆栈溢出问题

# views/layouts/application.html.haml
-# Include DataTables stylesheets
-# http://datatables.net
-# BUGFIX
-# Note the lack of a http: protocol definition to prevent force_ssl config setting
-# from preventing content loading
-# http://stackoverflow.com/questions/18121258/the-page-at-url-ran-insecure-content-from-url-in-chrome
= stylesheet_link_tag '//cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css'
= javascript_include_tag '//cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js'

关于ruby-on-rails - 如何阻止谷歌搜索链接到 https?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38556468/

相关文章:

ruby-on-rails - 从 SonarQube 和 SCM-Activity 插件中检索解密的 Blame 信息

ruby-on-rails - 在开发模式下设置 ssl on rails 4 app

PHP cURL 调用返回错误 56 和 NSS 错误 -12195

django - 从 Heroku 上托管的 Django 项目的子目录运行非 Django 命令?

ssl - 带有 Yahoo! 的 Heroku 应用程序托管域 SSL

java - 当我明确告知 Heroku 时,为什么 Heroku 无法识别正确的 Java 版本?

ruby-on-rails - 未知属性 - 属性存在

ssl - heroku 免费套餐和 SSL 证书解决方法?

python - aiohttp 和客户端 SSL 证书

ruby-on-rails - Rails 3.1 中 SASS @import 的问题