【问题标题】:SSL Certificate WPEngine to Heroku Rails到 Heroku Rails 的 SSL 证书 WPEngine
【发布时间】:2015-09-11 14:19:33
【问题描述】:

我们在 WPEngine 上有一个激活 SSL 的网站,因此每个页面都通过 https 提供。

我们最近在 Heroku 上切换到 Ruby on Rails。现在我们在使用 https 时出现了一些错误:

Your connection is not private
Attackers might be trying to steal your information from myapp.com (for example, passwords, messages, or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID

当我执行curl 检查我的自定义域或herokuapp 域时,SSL 得到验证。

curl -kvI https://myapp.herokuapp.com
# SSL certificate verify ok.
curl -kvI https://myapp.com
# SSL certificate verify ok.

Chrome 中的错误是:

This server could not prove that it is myapp.com; its security certificate is from *.herokuapp.com. This may be caused by a misconfiguration or an attacker intercepting your connection.

在我的 production.rb 我有:

config.force_ssl = true

【问题讨论】:

    标签: ruby-on-rails ssl heroku https


    【解决方案1】:

    不久前,我们的 Java 应用程序也遇到了同样的问题。我可能错了,但是 Heroku PaaS 在 dynos 后面有他们的云代理,默认情况下它会覆盖请求标头(在我们的例子中是从 https-to-http)。我想您可能有兴趣检查 X-Forwarded-For 标头。我们的解决方案是在Procfile 中显式传递请求上下文参数。

    Procfile 应该包含类似的内容(对于 Java): ..--context-xml <contextWithHeaderOptions>..

    实际context.xml:

    <Context>
        <Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="x-forwarded-for" protocolHeader="x-forwarded-proto" portHeader="x-forwarded-port"/>
    </Context>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-08
      • 1970-01-01
      • 1970-01-01
      • 2012-10-23
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多