Trying to access WebUI externally through Cloudflare gives error 502

Hi everyone, I haven’t seen any other forum talking of the problem so I guess I’ll ask for help myself. So I want to access the WebUI externally through Cloudflare so I can protect my origin IP address. I can access it without Cloudflare, but when I go through Cloudflare it comes up with a Cloudflare specific error page saying that the server returned an error 502 bad gateway. If anyone can help me fix my problem I would appreciate it greatly.

UPDATE: I noticed one day the webui wasn’t working at all, so I restarted it and then it magically began working behind cloudflare. Although cloudflare ssl still won’t work with it, I don’t care too much about that but if anyone knows a quick solution just let me know.

I’m not familiar with cloudflare SSL, but does that mean they literally give you an SSL certificate?

Sorry I should probably close this, I got it working my using the nodejs version instead of the python version of the webui. Cloudflare’s free tier gives you free ssl certificates for your main domain and 2 subdomain but it seems to be working for every subdomain I have, anyway I digress. My issue is solved by simply moving to nodejs which I think is a better version. I should have used that right from the get go.

EDIT: Sorry forgot one important thing, they don’t literally hand you the certificate. It goes through their servers and they must have it on their end doing the work.