我已经在codeigniter中实现了一个网站,最近我将其上传到了具有SSL的生产服务器上。
问题是,如果我使用“ http”输入,一切正常。如果我使用“ https”输入,则找不到所有的CSS和JS。错误是:
Mixed Content: The page at 'https://www.xxxx.com/' was loaded over a secure connection, but contains a form which targets an insecure endpoint 'http://www.xxxx.com/secure/validate_credentials'. This endpoint should be made available over a secure connection.
Mixed Content: The page at 'https://www.xxxx.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://www.xxxx.com/assets/font-awesome/css/font-awesome.css'. This request has been blocked; the content must be served over HTTPS.
我已经在codeigniter中编辑config.php
例如$ config ['base_url'] =“ https://www.xxxx.com/”
但是仍然会发生,如何调试和修复它?感谢您的帮助
最佳答案
错误信息中包含所有内容:
This request has been blocked; the content must be served over HTTPS.
看来您的html中有指向“ http”的静态链接。因此,不要像这样直接在html中直接使用协议:
http://www.xxxx.com/assets/font-awesome/css/font-awesome.css
将其更改为如下所示:
assets/font-awesome/css/font-awesome.css
还要记住,如果您尝试使用未配置为通过https提供内容的其他域中的JS或CSS,则会遇到此问题。
关于javascript - 无法在使用SSL的服务器中获取CSS和JS文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29740300/