Bypass original 5xx error from the origin server

I configured cloudflare on my web application. Everything works fine.

However, when my API backend returns 5xx error CF intercepts it and returns its branded 502 error HTML page. I have two big issues here:

  1. The API endpoints should always return JSON to be understood correctly by the clients
  2. The original error from my server contains helpful information for the client to troubleshoot the issue.

So is there any way I can bypass CF error page and get the original response from the API back to the client?

This topic was automatically closed after 31 days. New replies are no longer allowed.