502 (bad gateway) errors are usually network configuration problems, - and I must admit usually nightmare to debug and fix in complex setups…
That said, we would need much more details and error log to be able to help you.
How is Cells configured (cells configure sites)?
Can you access Cells directly?
How is cloudflare configured? Do you have any log on this side?
And a final note, like with e.g. Azure WAF, using Cells behind Cloudflare introduces issues when uploading very large files that are not trivial to solve - keep this in mind while you are designing and testing your solution before you go live.