502 Error randomly showing up after a couple of refreshes

Currently my website is hosting via Cloudflare Tunnel running on my windows 10 machine, it starts just fine, my website spins up and is displayed very quickly like it should, however random 502 errors keep popping up, sometimes after refreshing, and sometimes just completely random while idle. Im barely sending any traffic to Cloudflare, and i made sure my server code was efficient. Changing hosts to NGROK has fixed this issue but i want to use Cloudflare as their speeds are untouchable.