
You can link most HTTP errors to a specific cause: 404 means something is not there, 500 means something is broken on the server side. But then there's the 520 status code. It does something a little different. You usually see this code when your site is running behind a service like Cloudflare. It's not an official HTTP status, but a proprietary addition of reverse proxies like Cloudflare when the server sends something they can't interpret.
In short: the proxy server does get an answer back from your server, but it is not correct. Either it is empty, or it is broken, or it deviates so much that the proxy crashes with it. The result: the end user is presented with a 520. Not an error coming from the browser, nor one coming directly from your server. But exactly in between.
Why do you get to see an http 520?
The http 520 error is actually a signal that there is miscommunication between two systems. The client (browser) sends a request to Cloudflare (or another proxy), which forwards that request to your server. The server replies, but does so in a way that the proxy does not understand or accept.
What that means in practice? A few possibilities:
- The server sends a response without headers.
- Status line is missing or contains invalid format.
- There is a conflict with a plugin or server module.
- A firewall on your server blocks incoming requests from Cloudflare.
- An attempt is being made to send a gzip response while something is corrupted.
You notice: these are all things that fall just outside the usual errors, and thus are not immediately noticed by normal debugging tools. That sometimes makes finding the cause difficult.
Where can you find it?
If you use tools like Screaming Frog, you can detect 520 errors during crawling. The tool categorizes it as a server error, but you won't be able to tell the exact cause from the status code. For that, you have to dig into your own server logs.
Cloudflare itself often shows the error as "Web server returned an unknown error." In most cases, that doesn't include much additional information unless you enable logs or work with debugging headers.
How do you resolve a 520 error message?

There is no one universal solution, but there are logical steps you can take to isolate the cause:
- Check your server logs. Especially the error logs from Apache or Nginx can be crucial here. Look for incomplete responses or error messages while rendering a page.
- Restart your Web server or PHP service. Sometimes they are temporary glitches that disappear with this.
- Check firewall and security rules. Some setups block Cloudflare's IP ranges, which can lead to this error.
- Remove or deactivate recently added plugins or extensions. Especially when it comes to caching or compression.
- Make sure your headers are constructed correctly. Most proxies expect specific headers and get confused by different formats.
In extreme cases, you could try temporarily pausing Cloudflare (by having your DNS point directly to your origin server) and see if the problem still occurs then. This will tell you whether the problem is on Cloudflare's side, or on your own server.
What makes status code 520 tricky?
Unlike many other error codes, the 520 status code not standardized. You won't find it in the official HTTP specs. As a result, many monitoring tools don't work with it, and with some hosts you also get little insight into what exactly is happening.
Another factor: 520 is often a result of a series of circumstances. Not one obvious error, but an accumulation of factors, a combination of headers, server behavior and network settings. That very fact makes it difficult to pin a single cause on it.
Summary
The 520 status code is a bit of an oddity. It's not an official error message, but a proxy response when your server returns something unexpected. This makes it difficult to debug, but with the right steps and tools, such as Screaming Frog and server logs, you can often still get to the root of the problem.
So do you see a message like http 520 or "Web server returned an unknown error"? Then chances are that somewhere between proxy and server things aren't quite running smoothly. Time to check your headers, dig through your logs and refresh your configuration. Because even though it's not an official status code, it's an error you should take seriously.