在单个Heroku应用程序中是否可以拥有多个SSL证书?
我们有多个不同类型和TLD的域名指向我们的应用程序,需要保护每个域名。最好不要重定向到不同的安全URL。
在单个Heroku应用程序中是否可以拥有多个SSL证书?
我们有多个不同类型和TLD的域名指向我们的应用程序,需要保护每个域名。最好不要重定向到不同的安全URL。
有一种方法可以将多个SSL端点路由到同一个应用程序。
SSL端点通过终止SSL连接并将未加密的流量注入到正常的Heroku路由层中来工作。
您可以通过创建一个新的应用程序和一个新的SSL端点来利用它,以终止SSL连接并将流量路由到现有的应用程序:
将您的域名添加到您的应用程序中:
$ heroku domains:add ssl.example.com
创建一个新的应用程序:
$ heroku create endpoint-for-example-com
添加SSL端点附加组件($20/月):
$ heroku addons:create ssl:endpoint --app endpoint-for-example-com
将您的证书添加到新的应用程序:
$ heroku certs:add server.crt bundle.pem server.key --app endpoint-for-example-com --type endpoint
Resolving trust chain... done
Adding SSL Endpoint to endpoint-for-example-com... done
endpoint-for-example-com now served by kagawa-1482.herokussl.example.com
使用分配给您的新应用程序的ssl端点(例如kagawa-1482.herokussl.example.com
)作为您希望保护的域名的CNAME主机。通常在您的域名的DNS配置中完成此操作。
新应用程序不需要任何dynos,但是将为SSL端点附加组件收取每月20美元的费用。
注:
certbot certonly --standalone -d example.com -d www.example.com -d test.net
上传自定义证书可参考heroku doc。Copying /System/Library/OpenSSL/openssl.cnf
to the current directory, and amending the relevant sections ([req]
and [v3_req]
):
[req]
req_extensions = v3_req
[v3_req]
subjectAltName=DNS:www.example1.com,DNS:www.example2.com,DNS:www.example3.com
Then I used this new .cnf when generating the CSR:
openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -config openssl.cnf
I purchased the cert from SSLs.com. Their Comodo "PositiveSSL Multi-Domain" is $25.99/yr as of this writing and support from 3-100 domains (domains over 3 cost something like $12).
I concatenated the CA bundle and .crt that I was sent into a single .crt (in that order) and added it to Heroku. All 3 domains were added to the app and pointed to the same CNAME, and all resolve over https:// as expected.
如果这对任何有兴趣的人来说是可行的路线,那么比每年240美元的额外端点便宜得多。
相关链接:
我正在处理这个问题。Heroku建议获取一个SAN/UCC证书,它可以让你列出多个域名。我刚刚在GoDaddy上完成了这个操作,目前看起来一切都正常。
https://devcenter.heroku.com/articles/ssl-endpoint#serving-multiple-domains