Welcome Guest, Not a member yet? Register   Sign In
Getting CodeIgniter to work with SSL
#1

[eluser]swissbastian[/eluser]
Hi there

I've been browsing the web for a solution but couldn't find what I'm looking for.

I built a web application with CI and would like to run it with SSL. The certificate has been successfully installed by my host and I changed my config file so the base_url now starts with https://

Well, the browser (Safari on Mac/iOS) is using HTTPS but in the address bar the certificate doesn't show up.

My host answered that although HTTPS is being used connections with HTTP are still happening. Therefore it is not secure and I should fix these HTTP connections.

Really, I have no idea where to start now. Any ideas what steps to take now?

Regards,
Bastian
#2

[eluser]Tpojka[/eluser]
Search gives this interesting post.
#3

[eluser]swissbastian[/eluser]
This post mentions three other articles. The first one doesn't exist anymore, the second one describes SSL for just a selection of views (I'm looking for a solution to have SSL for the whole project). The third thread consists of just the opening post with the question.

Then the author of the linked post describes a solution with a force_ssl helper. But that helper just rewrites the base_url from http to https. I already have https in the config file for the base_url.
#4

[eluser]Ewout[/eluser]
Inspect the webpage and look for the 'NET' tab (in Firefox). There you see which resources are loaded. Everything there should come from a https url. If not the ssl will not persist.
#5

[eluser]CroNiX[/eluser]
Are your images, js, etc also using the ssl url? Everything must be served via ssl, not just the main url.
#6

[eluser]Tpojka[/eluser]
This post can be helpfull too.
#7

[eluser]swissbastian[/eluser]
Thanks for all your suggestions.

I rewrote the .htaccess file. It now shows up as follow:

Code:
RewriteEngine on
RewriteBase /

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://piks.ch/$1 [R,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

@Ewout:
Thanks for this tip. I looked it up and it seems, that every resource is loaded through https.

I have tested the site with Safari, Firefox and Chrome (all on Mac). Chrome and Firefox works great. The redirection from http to https works and the certificate show up in the address bar. Only Safari fails. That's so weird…
#8

[eluser]swissbastian[/eluser]
Oh damn it, I found the mistake!

The web font I'm loading from Google wasn't linked with https. So this was the resource that led Safari to not showing the certificate. Now everything seems to work great.

Sorry for that.
#9

[eluser]Ewout[/eluser]
A smart thing to do in the future, is to load all Javascript, css and images via this url structure "//www.domain.com".. then the resources will be loaded by whatever protocal the url has Wink




Theme © iAndrew 2016 - Forum software by © MyBB