【问题标题】:Specifying the SSL endpoint for Heroku Domains为 Heroku 域指定 SSL 端点
【发布时间】:2015-10-16 23:45:40
【问题描述】:

我有两个 Heroku 应用层(一个生产应用和一个暂存应用)

我的 DNS 配置为指向其中一个,具体取决于子域。

  • *.example.co -> app-production
  • *.staging.example.co - > app-staging

SSL

两者都启用了 SSL 附加功能。将完全相同的 SSL 通配符证书上传到两者。

> heroku certs --remote production
Endpoint                      Common Name(s)            Expires               Trusted
----------------------------  ------------------------  --------------------  -------
tokushima-XXXX.herokussl.com  *.example.co, example.co  2018-10-10 00:00 UTC  True


> heroku certs --remote staging
Endpoint                      Common Name(s)            Expires               Trusted
----------------------------  ------------------------  --------------------  -------
hiroshima-XXXX.herokussl.com  *.example.co, example.co  2018-10-10 00:00 UTC  True

每个都有相应的域也在 Heroku 中配置

> heroku domains --remote production

=== app-production Custom Domains
Domain Name                    DNS Target
-----------------------------  -------------------------------------
*.example.co                   tokushima-XXXX.herokussl.com
example.co                     tokushima-XXXX.herokussl.com


> heroku domains --remote staging

=== app-staging Custom Domains
Domain Name           DNS Target
--------------------  ------------------------
*.staging.example.co  app-staging.herokuapp.com   <-- should this be the SSL endpoint?

问题

以上所有在路由方面都可以正常工作。

  • foo.example.co 访问我的生产应用程序
  • foo.staging.example.co 访问我的临时应用程序

但是在暂存时,SSL 不起作用。我收到“证书不受信任”错误,即使它是同一个证书。

我强烈怀疑这是因为在配置暂存域时,DNS 目标应该是 SSL 端点,而不是直接的 heroku 应用 URL。

但我无法编辑它。如果我这样做了

> heroku domains:add *.staging.example.co --remote staging

它会自动为我添加 DNS 目标。在 Prod 上,它自动添加了 SSL 端点。

有没有办法解决这个问题?

【问题讨论】:

    标签: ruby-on-rails ssl heroku


    【解决方案1】:

    这是 ssl 通配符证书的行为方式:*.example.com 的证书对 foo.example.com 有效,但对 bar.foo.example.com 无效。

    这是在rfc 2818 中指定的,上面写着

    名称可能包含通配符 字符 * 被认为与任何单个域名匹配 组件或组件片段。例如,*.a.com 匹配 foo.a.com 但 不是 bar.foo.a.com。 f*.com 匹配 foo.com 但不匹配 bar.com

    【讨论】:

    • 啊,我明白了。所以看起来没有真正的解决方法,除非我要为*.staging.example.co 购买另一个通配符证书,对吧?或者,由于它是暂存的,我也可以生成一个自签名证书。但这能解决问题吗?谢谢!
    • 自签名证书可以工作(一旦您告诉浏览器信任它),您也可以通过对多个域名有效的证书(您必须在生成证书时提供完整列表)
    猜你喜欢
    • 2012-12-26
    • 1970-01-01
    • 2017-12-28
    • 2016-05-14
    • 2012-06-04
    • 1970-01-01
    • 2012-09-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多