简体   繁体   English

Heroku 自动证书管理在一个域中失败

[英]Heroku Automated Certificate Management failed with one domain

I am trying to get the SSL certification for my app with Heroku, but the Automated Certificate Management is failing for one of both domain names.我正在尝试使用 Heroku 为我的应用程序获得 SSL 认证,但是两个域名之一的自动证书管理失败。

I created the dyno before March 2017, so I had to run heroku certs:auto:enable as explained here .我在 2017 年 3 月之前创建了 dyno,因此我必须按照此处的说明运行heroku certs:auto:enable

Then, heroku domains returns:然后, heroku domains返回:

Domain Name         DNS Record Type  DNS Target
───────────────     ───────────────  ─────────────────────────────
example.com         ALIAS or ANAME   example.com.herokudns.com
www.example.com     CNAME            www.example.com.herokudns.com

This seems to be in line with what heroku expects .这似乎符合heroku 的预期

Anyway, heroku certs:auto returns:无论如何, heroku certs:auto返回:

Domain             Status
───────────────    ────────────
example.com        Failing
www.example.com    OK          

I admit that I am quite illiterate for settings concerning domains, DNS and so on.我承认我对有关域、DNS 等的设置一窍不通。 Therefore, this might be a very simple mistake from my side.因此,从我的角度来看,这可能是一个非常简单的错误。 However, I read the Heroku troubleshooting documentation and also similar questions in SO such as a this one or this one and still have no clue what is wrong.但是,我阅读了Heroku 故障排除文档以及 SO 中的类似问题,例如this onethis one ,但仍然不知道出了什么问题。

The fact that www.example.com is OK but example.com is failing just confuses me even more. www.example.com还可以但example.com失败的事实让我更加困惑。 And unfortunately, I received a notification email with no failure reason .不幸的是,我收到了一封没有失败原因的通知电子邮件。

Namecheap名称便宜

I guess the problem is either on Heroku or where I bought the domain.我想问题要么出在 Heroku 上,要么出在我购买域名的地方。 That is Namecheap.com.那就是 Namecheap.com。

There, at the Domain tab I have:在那里,在Domain选项卡上,我有:

NAMESERVERS Namecheap BasicDNS

REDIRECT DOMAIN   Source URL     Destination
                  example.com    http://www.example.com

And at the Advanced DNS tab:Advanced DNS选项卡上:

Type                  Host    Value                               TTL
-------------         -----   -------------------------------     -------
CNAME Record          www     example.com.herokudns.com           Automatic
TXT Record            @       google-site-verification...         Automatic
URL Redirect Record   @       http://www.example.com/ Unmasked

What am I doing wrong?我做错了什么?


Update更新

The issue seems to be due to Namecheap.这个问题似乎是由于 Namecheap。 I found the following ticket on Heroku:我在 Heroku 上找到了以下票证

Issue问题

User is having trouble pointing their root domain (aka apex domain/naked domain) to their Heroku app, either with setting the right DNS records, or accessing it over HTTPS.用户无法通过设置正确的 DNS 记录或通过 HTTPS 访问来将他们的根域(又名顶点域/裸域)指向他们的 Heroku 应用程序。

Resolution分辨率

Root domains on Heroku require the use of "CNAME-like" records, often referred to as ALIAS or ANAME records. Heroku 上的根域需要使用“类 CNAME”记录,通常称为 ALIAS 或 ANAME 记录。

Unfortunately, a number of popular DNS hosts such as GoDaddy, Namecheap, Bluehost, and others do not support these types of records.不幸的是,许多流行的 DNS 主机(例如 GoDaddy、Namecheap、Bluehost 等)不支持这些类型的记录。 Instead they tend to offer the following:相反,他们倾向于提供以下内容:

  • A records A记录

  • URL redirects / forwarding URL 重定向/转发

There are caveats with both of these options...这两个选项都有一些警告......

Surprisingly, I did not find any place where all the steps were explained clearly.令人惊讶的是,我没有找到任何地方将所有步骤都解释清楚。 What I did so far is:到目前为止我所做的是:

  1. Open an account with a DNS host that supports this.在支持此功能的 DNS 主机上开设一个帐户。 I took DNSimple.我拿了 DNSimple。 At the time of writing, prices start from 5€/month but there is a trial month for free.在撰写本文时,价格从 5 欧元/月起,但有一个免费试用月。
  2. Transfering the domain costs 14€/year, so I just pointed the name servers at Namecheap to DNSimple and added the domain to DNSimple to create the DNS records.转移域的费用为 14 欧元/年,所以我只是将 Namecheap 的名称服务器指向 DNSimple并将域添加到 DNSimple 以创建 DNS 记录。
  3. Then came the configuration on DNSimple.然后是 DNSimple 上的配置。 I followed the step 1 in the documentation to redirect HTTP to HTTPs ;我按照文档中的步骤 1 将 HTTP 重定向到 HTTPS ignored the step 2, since Heroku's ACM had already done it;忽略第2步,因为Heroku的ACM已经做了; and for the step 3 the article Pointing the Domain Apex to Heroku was very helpful.对于第 3 步,将域 Apex 指向 Heroku的文章非常有帮助。 I added manually an ALIAS record and I also added a CNAME record, like this:我手动添加了一个ALIAS record ,我还添加了一个CNAME记录,如下所示:

     Type Name Content ───── ─────────────── ─────────────────────── ALIAS example.commyapp.com.herokudns.com CNAME www.example.commyapp.com.herokudns.com

At the beginning nothing was working and the browser showed the following error:一开始没有任何工作,浏览器显示以下错误:

This site can't be reached无法访问此站点

www.example.com's server IP address could not be found.找不到 www.example.com 的服务器 IP 地址。

Checking thetroubleshotting documentation I saw that the only possibility was the Name server propagation delay , so I waited.检查故障排除文档我看到唯一的可能性是Name server propagation delay ,所以我等待。 It felt like a very long time, but it actually took less than one hour until the site got online again.感觉时间很长,但实际上不到一个小时,网站就重新上线了。

However, the SSL certification keeps failing more than 48 hours later...但是,SSL 认证在超过 48 小时后不断失败......

供将来参考:联系 Heroku 支持后,他们手动刷新了我的证书请求,并最终为我的应用程序颁发了证书...

Check the answer here especially the CloudFlare solution as it is free检查这里的答案,尤其是 CloudFlare 解决方案,因为它是免费的

Automated certificate management also provisions you a free SSL cert from https everywhere.自动证书管理还为您提供来自 https 的免费 SSL 证书。 You don't need to buy a cert.您无需购买证书。

However namecheap won't work with ACM because they don't allow an “alias” record for your “apex” domain Ie your domain with no subdomain so https://example.com not https://www.example.com但是,namecheap 不适用于 ACM,因为它们不允许您的“顶点”域的“别名”记录,即您的域没有子域,因此https://example.com不是https://www.example.com

Your options are switch to a dns registrar that supports an “alias” record such as dnsimple.您的选择是切换到支持“别名”记录的 dns 注册商,例如 dnsimple。 They charge $5 a month in addition to the domain registration fee.除了域名注册费外,他们每月收取 5 美元。

Or alternatively use a free cloudflare instance which comes with SSL.或者,也可以使用 SSL 附带的免费 cloudflare 实例。

If you already bought a cert there is a way to upload it to Heroku via an SSL addon.如果您已经购买了证书,则可以通过 SSL 插件将其上传到 Heroku。

I use both DNSimple/Heroku ACM on some apps and cloudflare on some others.我在一些应用程序上使用 DNSimple/Heroku ACM,在其他一些应用程序上使用 cloudflare。 Both are equally nice but cloudflare is free and gives you a CDN too.两者都一样好,但 cloudflare 是免费的,并且还为您提供 CDN。

https://www.reddit.com/r/Heroku/comments/7wh5r4/setting_up_ssl_with_heroku_namecheap/ https://www.reddit.com/r/Heroku/comments/7wh5r4/setting_up_ssl_with_heroku_namecheap/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过自动证书管理在Heroku上强制使用Jetty嵌入式HTTPS - How to force HTTPS with Jetty Embedded on Heroku with Automated Certificate Management 一个特定域的证书验证失败(_ssl.c:645)>” - certificate verify failed (_ssl.c:645)>” for one particuar domain Heroku SSL - 没有给出的证书是域名证书 - Heroku SSL - No certificate given is a domain name certificate Foursquare & Heroku:证书验证失败 - Foursquare & Heroku: certificate verify failed 无法对Google域上托管的域使用自动证书管理 - Unsuccessful in using Automated Certificate Management for domains hosted on Google Domains 启用了Heroku自动证书管理,但仍然没有绿色标准 - Enabled Heroku Automated Cert Management but still No Green Bar 一个域上的多个 SSL 证书 - Multiple SSL certificate on one domain AWS ACM - 由于证书颁发机构身份验证 (CAA) 错误,一个或多个域名验证失败 - AWS ACM - One or more domain names have failed validation due to a Certificate Authority Authentication (CAA) error 每个域/网址的“SSLError 证书验证失败” - "SSLError certificate verify failed" for every domain/url SSL 证书颁发 GoDaddy 域,Heroku 服务器托管,Cloudflare SSL - SSL certificate issue GoDaddy domain , Heroku Server hosting , Cloudflare SSL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM