Fix Cloudflare Error 520: Web Server Is Returning An Unknown Error (2025)
Updated: 11/29/2025
You type in your domain, hit Enter, and instead of your homepage you get a white page with Error 520, Web Server Is Returning An Unknown Error. Visitors start sending screenshots, uptime monitors go red, and you are stuck in the middle between Cloudflare and your hosting provider. Error 520 means Cloudflare connected to your origin, but the origin answered with something empty, invalid, or unexpected, so Cloudflare gave up and showed this generic page to your users [web:48][web:51][web:54].
Table of Contents
Method 1: Check Origin Server Health And Logs
The fastest way to stop Error 520 is to verify that your origin server is actually responding correctly when Cloudflare is not in the way, then look for crashes or malformed responses in its logs [web:48][web:51][web:54].
Step 1: Bypass Cloudflare And Hit Origin Directly
Log into your Cloudflare dashboard, open your site, and temporarily disable the orange proxy cloud for your main A or AAAA record so it turns grey, this makes traffic go straight to your origin IP. Now open your site using the origin hostname or direct IP if possible, if you still get errors or blank responses, the problem is on the origin, not Cloudflare [web:48][web:51].
Step 2: Check Web Server Error Logs
On your hosting control panel or server, open the error log for your web server, such as error.log for Nginx or Apache. Look for entries that match the exact time visitors saw Error 520, such as PHP fatal errors, segmentation faults, or gateway timeouts, these clues tell you whether a script crash or upstream timeout caused Cloudflare to see an empty or broken response [web:54].
Step 3: Restart Web Services Cleanly
If logs show repeated crashes or timeouts, perform a clean restart of your web stack, for example restart PHP FPM, Nginx or Apache, and any application containers. Many short lived 520 incidents clear immediately once the underlying process pool is refreshed and memory leaks are temporarily reset [web:54].
Method 2: Fix Common Configuration Issues Between Cloudflare And Origin
Cloudflare may treat certain non standard or malformed headers from the origin as an unknown error, especially if they exceed size limits or conflict with HTTP specifications. Review your server config and application code for oversized custom headers or duplicated headers, trim unnecessary values, and retest to see if replies become stable again [web:51][web:54].
Method 3: Re enable Cloudflare And Escalate If Needed
Open a ticket with your hosting provider or Cloudflare support and attach the Ray IDs, HAR files, and any relevant log snippets that show what the origin returned during failed requests. This combined data makes it much easier for engineers to pinpoint whether the root cause is at the web server, application code, or an edge case in Cloudflare configuration [web:48][web:54][web:57].