Avoid the removal of “https:” from URLs

It was caused by CloudFlare https (which doesn’t set the $_SERVER['HTTPS'] variable), I solved it by forcing:

$_SERVER['HTTPS'] = 'on';

in the webserver configuration. After doing so I could also disable the CloudFlare Flexible SSL plugin, and get a little performance gain.