s your setup is Cloudflare proxy -> Nginx proxy -> apache (mattermost)?
CF Proxy > Nginx Proxy > Mattermost (MM is its own server)
And yes, if I disable the CF Proxy, it works.
Why the double reverse proxies?
That's the standard. You are always expected to have your node.js servers behind a reverse proxy. And CloudFlare is the CDN cache in front. This is the universal standard for all web servers. Plenty of times to avoid it, of course, but this is the baseline system design.
In this case, MM is a raw node server so has none of the protections or handling of a system like Nginx. Nginx also provides the ability to have multiple sites behind one IP address. MM doesn't do that on its own, nor does CloudFlare. No different than how MangoLassi is on NodeBB, also a node platform, behind Nginx, behind CloudFlare.
CF can't do the details port and IP handling, Nginx can't do the globally distributed cache.
Thanks for the clarification Scott. I (wrongly) thought that Cloudflare was a full featured proxy and could do the same job as haproxy, nginx etc.