简体   繁体   English

通过Amazon CloudFront上的HTTPS提供静态内容

[英]Serving static contents through HTTPS on Amazon CloudFront

I am a bit confused on how to make CloudFront work as a CDN under SSL. 我对如何使CloudFront作为SSL下的CDN感到有些困惑。

My whole website runs under HTTPS, by using a (not-self-signed) wildcard SSL Certificate: let's say https://www.mysite.com 我的整个网站通过使用(非自签名)通配符SSL证书在HTTPS下运行:假设https://www.mysite.com

I created a new distribution in CloudFront, setting mysite.com as origin, and setting only HTTPS as behaviour, and match view protocol. 我在CloudFront中创建了一个新发行版,将mysite.com设置为来源,仅将HTTPS设置为行为,并匹配视图协议。

When in my html in insert 在我的html中插入时

<link rel=\"stylesheet\" type=\"text/css\" href=\"//XXXX.cloudfront.net/css/style.css\" />

this generates an HTTP request and that the browser blocks. 这将生成一个HTTP请求,浏览器将阻止它。

常规选项

起源

行为举止

Google Chrome网络面板

Google Chrome控制台日志错误

I finally found the reason. 我终于找到了原因。 the origin domains was mydomain.com while on the webserver there is a redirect from mydomain.com to www.mydomain.com. 原始域是mydomain.com,而在网络服务器上,存在从mydomain.com到www.mydomain.com的重定向。

It was sufficient to create a new distribution with origin name: www.mydomain.com 创建一个具有原始名称的新发行版就足够了:www.mydomain.com

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM