Reputation: 13555
I have implemented a website in codeigniter , recently I upload it to the production server that has SSL on it.
The problem is , if I enter using "http", everything works fine. If I enter using "https" , then all css and js is not found. And the error is :
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.
I have already edit the config.php in codeigniter
e.g. $config['base_url'] = "https://www.xxxx.com/"
but still happen, how to debug and fix it? Thanks for helping
Upvotes: 1
Views: 4136
Reputation: 711
Like maque said You have everything in you error message
But it is recommended to use base_url()
instead of site_url
for resources and like css, js and images.
you may upgrade to Codeigniter 3.0 it is still in develop in the time of writing this answer
but it is very solid at this stage and it has better version of base_url()
and site_url()
as you can now add the protocol in the argument like that
site_url("assets/js/jquery.min.js", "https")
Upvotes: 1
Reputation: 686
You have everything in you error message:
This request has been blocked; the content must be served over HTTPS.
It looks like you have static link in your html to 'http'. So instead of using protocol directly in your html like that:
http://www.xxxx.com/assets/font-awesome/css/font-awesome.css
Change it to something like this:
assets/font-awesome/css/font-awesome.css
Also remember that if you are trying to use JS or CSS from other domains that are not configured to serve content with https you will encounter this issue.
Upvotes: 2