Errors from GraphQL behind Cloudflare are not delivered to browser

I have quite a general question.
So we have a GraphQL backend behind traefik ingress.
Also we have a frontend that is talking to this GraphQL and handles its response. It depends heavily on the return of it and expects JSON from it.
However, on Cloudflare Pro plan, if a server returns a 500 Server error status, Cloudflare transforms it into an HTML page of status 520.
Who can advise on how to fix this?

Cloudflare would not normally interfere with a 5xx response from the server.

Could you show an example of the requst (including headers) as it is sent hy the front end, as it is received by the back end and what the server’s response is?

Hi Laudian,
Sorry for silly answer, but it seems I’ve tweaked the traefik over the weekend and now it does not produce this error in the same situation :woozy_face:
It’s strange though that you say that CF does not interfere. It does translate error 500 to 520, 502 to 522 etc, to show its own error page.

Error in browser looked like this:

I’ll return here once we have this reproduced.

It seems you are right.

I’ve tried responding with some custom error pages myself, and some of them are served to the browser, while others are replaced by Cloudflare error pages.

500 and 501 worked, while 502, 520 and 522 were replaced.

According to this, 500, 501, 503, and 505 are untouched, and 502 and 504 Origin errors can be enabled on Enterprise plans.