Cloudfront/S3-bucket 的 Cloudflare HTTPS 子域给出 403

Cloudflare HTTPS subdomain to Cloudfront/S3-bucket gives 403

我正在为我的 DNS 使用 Cloudflare 并且已启用 SSL。 我正在尝试设置一个子域; https://humlor.myrenas.se and point that to an AWS S3-bucket. I have Set up Cloudfront with a Default CloudFront Certificate (*.cloudfront.net) and the site is available at https://d2ufhnw2kk1vh9.cloudfront.net/(没有 CSS 的某些绝对路径的样式)

然后我在 Cloudflare 中创建了一条 CNAME 记录:CNAME humlor 是 d2ufhnw2kk1vh9.cloudfront.net

的别名

但是 https://humlor.myrenas.se/ 给出: 403错误 无法满足请求。 错误的请求。

我是否需要在 Cloudfront 中使用其他证书?或者缺少了什么?

对于“https://humlor.myrenas.se 并将其指向 AWS S3 存储桶”:您需要 route53,通过它您的 URL 将能够指向 s3 存储桶(s3 存储桶的名称也应该是 humlor.myrenas.se)

当你有云耀斑时,你不需要云端...

你的 DNS 将在云耀斑上,在那里你将你的 URL 映射到 AWS IP --- AWS route53 接受这个 URL 并指向你的 s3 存储桶并且默认页面显示在那里

此错误消息几乎总是表示请求确实到达了 CloudFront,但 CloudFront 无法识别 HTTP header 中包含的主机名。这表明您忽略了在 CloudFront 分配中设置 备用域名 的必要性。

If you want to use your own domain name, such as www.example.com, instead of the cloudfront.net domain name that CloudFront assigned to your distribution, you can add an alternate domain name to your distribution for www.example.com.

https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html

默认情况下,CloudFlare 不会更改浏览器发送的 Host header,因此 CloudFront 在传入请求中看到您的自定义域名,并且不知道下一步该做什么,因为没有已配置的分配将此名称配置为备用域名,所以它 returns 这个错误。