Unexplained 502 error

Recently, I encountered a baffling 502 error. It occurred when some of my users accessed my /auth/register/ endpoint via POST. Cloudflare returned the edge error code 502 Bad Gateway shortly after the request was initiated (I assure you, the request took less than 100 seconds), and my server's correct response was never transmitted. In some cases, requests didn't even reach my server at all (I couldn't find any logs indicating this), with Cloudflare directly returning the 502 error. I can assure you my server connections and this endpoint's functionality are working properly, as I and many other users can access it normally.

I would like to know under what specific circumstances Cloudflare will directly return an edge status code 502 when the origin server is functioning normally, has not timed out, and has not provided a response.
Was this page helpful?