简体   繁体   English

Cloudflare + Heroku SSL

[英]Cloudflare + Heroku SSL

I have a rails app that is running on heroku and am using Cloudflare Pro with their Full SSL to encrypt traffic between: User <-SSL-> Cloudflare <-SSL-> Heroku, as detailed in: http://mikecoutermarsh.com/adding-ssl-to-heroku-with-cloudflare/ . 我有一个在Heroku上运行的Rails应用程序,并且正在使用Cloudflare Pro及其完全SSL来加密以下用户之间的流量:用户<-SSL-> Cloudflare <-SSL-> Heroku,详细信息如下: http ://mikecoutermarsh.com/ 将ssl添加到带有cloudflare /的heroku中

I am also using the rack-ssl-enforcer gem to force all http requests to go through https. 我还使用了rack-ssl-enforcer gem来强制所有http请求通过https。

This is working properly, except I have the following issues, by browser: 通过浏览器,除我遇到以下问题外,此方法工作正常:

1) Firefox. 1)Firefox。 I have to add a security exception the first visit to the site, getting the "This site is not trusted" warning. 我必须在首次访问该站点时添加一个安全例外,并得到“此站点不受信任”的警告。 Once on the site, I also have the warning in the address bar: 进入网站后,我还会在地址栏中显示警告: 在此处输入图片说明

2) Chrome: page loads first time, but the lock in the address bar has a warning triangle on it, when clicked displays: 2)Chrome:页面首次加载,但地址栏中的锁上带有警告三角,单击时显示:

Your connection is encrypted with 128-bit encryption. 您的连接已使用128位加密进行了加密。 However, this page includes other resources which are not secure. 但是,此页面包括其他不安全的资源。 These resources can be viewed by others while in transit, and can be modified by an attacker to change the look of the page. 这些资源可以在传输过程中被其他人查看,并且可以被攻击者修改以更改页面的外观。 The connection uses TLS 1.2. 该连接使用TLS 1.2。 The connection is encrypted and authenticated using AES_128_GCM and uses ECDHE_RSA as the key exchange mechanism. 该连接使用AES_128_GCM进行加密和身份验证,并使用ECDHE_RSA作为密钥交换机制。

Safari: initially loads with https badge, but it immediately drops off Safari:最初加载时带有https徽章,但立即消失

Is there a way to leverage Cloudflare SSL + piggyback of Heroku native SSL without running into these security warnings? 有没有办法在不遇到这些安全警告的情况下利用Cloudflare SSL + Heroku本机SSL的搭载? If not, I don't see much value in the configuration. 如果没有,我认为配置没有太大价值。

My apologies for slinging erroneous accusations against Cloudflare and Heroku :-) 我很抱歉对Cloudflare和Heroku提出错误的指控:-)

Turns out the issue was not the fault of either, but instead that images on the app (being served from AWS S3) were being served up without https. 事实证明,问题并不是这两者的错,而是该应用程序上的图像(由AWS S3提供)在没有https的情况下提供了。

If anyone runs into this situation, lessons learned across a wasted day: 如果有人遇到这种情况,那么浪费的一天就会吸取教训:

S3 only lets you serve up content via https if you serve from your bucket's dedicated url: s3.amazonaws.com/your-bucket-name/etc.. 如果您从存储桶的专用网址s3.amazonaws.com/your-bucket-name/etc中进行投放,则S3仅允许您通过https提供内容。

a) I tried setting the bucket up for static website hosting, so I could use the url "your-bucket-name.your-url.s3-website-us-east-1.amazonaws.com/etc...", and then set up a CNAME within my DNS that sends "your-bucket-name.your-url" to "your-bucket-name.your-url.s3-website-us-east-1.amazonaws.com/etc...", to pretty up urls a)我尝试为静态网站托管设置存储分区,因此可以使用网址“ your-bucket-name.your-url.s3-website-us-east-1.amazonaws.com/etc ...”,然后在我的DNS中设置一个CNAME,将“ your-bucket-name.your-url”发送到“ your-bucket-name.your-url.s3-website-us-east-1.amazonaws.com/etc”。 ..”,以修饰网址

b) this works, but AWS only lets you serve via https with your full url (s3.amazonaws.com/your-bucket-name/etc..) or *.s3-website-us-east-1.amazonaws.com/etc...", which doesnt work if you have a dot in your bucket name (your-bucket-name.your-url), which was required for me to do the CNAME redirect b)可行,但是AWS仅允许您通过https提供完整网址(s3.amazonaws.com/your-bucket-name/etc。)或* .s3-website-us-east-1.amazonaws.com / etc ...”,如果您的存储桶名称(your-bucket-name.your-url)中有一个点,该功能将不起作用,这是我执行CNAME重定向所必需的

If you want to use AWS CDN with https, on your custom domain, AWS' only option is CloudFront with a SSL certificate, which they charge $600/mo, per region. 如果您想将AWS CDN与https一起使用,则在您的自定义域上,AWS的唯一选择是带有SSL证书的CloudFront,它们每个区域每月收取600美元的费用。 No thanks! 不用了,谢谢!

In the end, I sucked it up and have ugly image URLs that looks like: https://s3-website-us-east-1.amazonaws.com/mybucketname ...", and using paperclip, I specify https: with ":s3_protocol => :https," in my model. Other than that all is working properly now. 最后,我把它吸了起来,得到了看起来像丑陋的图像URL: https : //s3-website-us-east-1.amazonaws.com/mybucketname ...“,然后使用回形针指定https:和我的模型中的“:s3_protocol =>:https”。除此之外,所有这些现在都可以正常工作。

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

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