允许用户将自定义域用于我的云端应用程序

Allow users to use custom domain to my cloudfront app

我有一个域为 xyz123.cloudfront.net 的云端应用程序。 此 CloudFront 然后映射到域 sub1.mydomain.com。为此,我遵循了这些步骤。

  1. 通过 AWS CloudFront 面板将 SSL 添加到 *.mydomain.com
  2. 将 Route 53 中的 A Alias 记录添加到 xyz123.cloudfront.net

这使得 sub1.mydomain.com 通过 SSL 完美工作。

现在,我想允许我的用户使用他们自己的域(例如 sub1.userdomain.com)来访问该应用程序。 这类似于 UptimeRobot 在其 public 状态页面中允许的内容。

我试过了,但没有用

问题

  1. UptimeRobot(或 GitHub 页面)如何允许用户通过 SSL 向其状态页面添加自定义域
  2. 实现这一目标的先决条件是什么?
  1. 来自 https://github.blog/2018-05-01-github-pages-custom-domains-https/

    We have partnered with the certificate authority Let’s Encrypt on this project. As supporters of Let’s Encrypt’s mission to make the web more secure for everyone, we’ve officially become Silver-level sponsors of the initiative.

    Github 页面为您的自定义 userdomain.comYOURNAME.github.io 创建一个来自 Let's Encrypt 的证书。这可以通过 SAN 证书(主题备用名称,https://support.dnsimple.com/articles/what-is-ssl-san/)实现。

  2. 您不能将多个 SSL 证书关联到 CloudFront 分配,但 ACM(AWS 证书管理器)最多支持 10 个主题备用名称。要模仿 Github 页面,您必须事先知道用户域,或者在每次添加新域以替换旧域时创建一个新证书。

遗憾的是,无法将超过 10 个自定义域添加到 AWS 中的 SSL。 这是为您的云端设置自定义域的先决条件。

因此,解决方法如下所示。 1. 创建一个 S3 单一存储桶来托管您的代码 2.创建连接到单个S3 Bucket的多个Could front distribution 3. 然后,将自定义域添加到这些云端。

您还需要考虑应用 API 中的 CORS 设置,以允许来自这些自定义域的请求。