Your changes seem to be correct, however $config['host'] is modified elsewhere and reaches your code without the http://. The URI therefore gets prepended the unwanted https://.