如何在编码器上实现SSL时消除控制台错误


How to get rid of console error when implementing SSL on codeigniter

我最近使用了一种方法在我的基于codeigniter的web应用程序上强制使用SSL。我完全按照这里说的做了http://tutsnare.com/redirect-to-ssl-in-codeigniter/它起到了作用。所有页面都在HTTPS中加载,并带有锁标志。但是在控制台上,我得到这个错误

Mixed Content: The page at 'https://dev26.calvarycch.org/applications/index/children' was loaded over HTTPS, but requested an insecure script 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js'. This request has been blocked; the content must be served over HTTPS.

这是什么意思?如何删除呢?

在SSL背后运行网站时,所有内容都必须在SSL协议背后提供。这意味着所有的图像/css/javascript/字体/svg(我希望我没有忘记任何其他外部可选内容)也必须与https://(而不是http://)。

你需要去你所有的HTML,并确保每一个地方你使用http://(在图像/css/javascript)更改为https://,然而这是不是的东西,你可以自动做,因为不是所有的网站工作与SSL。

在您的具体示例中,google的CDN可以在HTTP和HTTPS中提供相同的文件,因此您只需更改:

<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>

注意开头的httpS