Request returns http instead of https

Yes, Cloudflare is the cause. As far as your webserver knows, it is http because of the port number.

Are you trying to generate a URL from Twig? If so, override $uri when creating the TwigExtension.

        $view->addExtension(new Slim\Views\TwigExtension(
            $c->get('router'),
            'https://example.com'
        ));

See this discussion for a very similar topic and solutions.