Use set_url_scheme instead of if (is_ssl())