Add support for https behind a reverse proxy using X-Forwarded-Proto

I have a server behind a loadbalancer which act like a reverse proxy, ie the connection is ssl up to the loadbalancer and between the loadbalancer and the webservice it's http.

Codeigniter was not able to correctly detect it was an https connection which resulted in base_urls of the form http://xxx.yyy.zzz. This prevented css/js to work. 

This patch correctly detects such cases.