I have a installation of Roundcube 1.6.6 behind a Cloudflare proxy and it works fine. I'm guessing it is aa issue with the cPanel customizations or web server config that is causing the problem.
I have 8 dedicated servers, and all the websites hosted on them are experiencing the same issue. Two of these servers were installed just 4 days ago without any modifications to cPanel. I only installed the system, cPanel, and transferred the websites to them without NS or anything only change DNS from cloudflare, yet the same problem.
But I followed the steps I mentioned above and solved the issue on all of my servers.
It's a temporary solution until roundcube and cpanel fix this issue.
Just so you know, when the issue was present, I created a subdomain in Cloudflare for another domain and linked the IP address of the server experiencing the problem. This allowed the webmail to work for me.
Example:
The problem was with this domain, "webmail.server1.com."
I added a subdomain on the domain "test.server2.com" and linked the IP address of server1 to the subdomain "test.server2."
This made the webmail work for me.