Have you ever seen an annoying Server Error 520? Web Server Is Returning An Unknown Error and wondered what causes this? Let’s find out with this article.
The Cloudflare 520 error is yet another common HTTP error. It can be frustrating for you as it can increase the bounce rate of your website.
Usually, error 520 occurs when the origin server doesn’t work properly as expected and couldn’t service the request. As a result, returns an empty, unknown or unexpected response. The most common reason for the error to occur is either a cronjob, the program is utilizing excessive server resources which makes the server misbehave and not able to manage all the requests appropriately.
Below are few probable reasons for the Cloudflare 520 error to occur:
- Origin Web server application crashes due to the execution of a resource-intensive script. Hence, the server is unable to provide timely responses to the requests.
- Cloudflare IPs are blocked by the origin server’s firewall. Whitelisting those IPs addresses will resolve the problem.
- Header size exceeding Cloudflare’s header size limit of 8kb. Hence, it won’t be able to process the header.
- Origin server returns an empty response, with no HTTPS status code or response body. This error triggers when the DNS of the domain points to the wrong server.
- The TCP protocol is responsible for establishing and maintaining a network connection. So, if the TCP idle timeouts are shorter than 300 seconds then this unknown error could be triggered.
Also Read: How to reduce bounce rate of a website
As we have discussed what the 520 error is and its cause, now let’s see how we can fix the error 520.
How to Fix the Error 520: Web Server Is Returning An Unknown Error?
Let’s see the troubleshooting steps to fix this HTTP error:
Before moving to the troubleshooting part, the first and foremost step is to disable Cloudflare. This is important as you need to isolate the Cloudflare factor from it.
First login to Cloudflare dashboard. Then, you can either disable Cloudflare from the homepage or turn off the Cloudflare DNS cloud.
To pause Cloudflare, you need to scroll down and go to the advanced actions and then click on the Pause Cloudflare on the Site link.
Go into development mode
Additionally, if you don’t want to disable or pause Cloudflare, you can go into the development mode and start troubleshooting the error.
Once, you have logged in to the Cloudflare dashboard, click on the caching tab (placed with other tabs at the top of the page).
Scroll down to the development mode section where you will see a small toggle button, turn it on.
Check out your server’s error logs
After disabling, pausing, or putting the Cloudflare into development mode, you can start troubleshooting error 520 by checking out your server’s error logs.
The method we provide is for cPanel users:
First of all, you need to log into cPanel. Look for the Errors button within the metrics section. Now click on it.
By default, the error log page will show the last 300 error messages. However, you can change the settings to read more error log messages.
Note: The setting can be changed if you have permission else you need to contact the host.
How to decode the error log
Ther error messages have structure. So, once you know the structure, you can easily decode the message.
Below is an example of an error message:
[Thu Jun 7 11:00:30 2018] [error] [client 184.108.40.206] error description: /path/to/file/with/error
Firstly, there is the date and time stamp then followed by LogLevel security that tells how severe the message is. Next, the client’s IP address and finally the actual message is shown and contains the path to the affected file.
Below, are the LogLevel severity level that can be found in the error log messages:
- Emerg notifies that the issue is highly important and the server can’t be accessed currently
- If Alert level is shown on the message, act quickly to avoid further damage
- Crit denotes the criticalness of the condition or state
- Error means something is wrong
- Warn message gives warning about the issue but it isn’t critical
- Notice gives some important details of server’s condition. But, you don’t need to worry much.
- Info provides general level information
- Debug messages contain the trace details while debugging is enabled.
The Error 520 can be a tricky error particularly as its a Cloudflare error.
Meanwhile, you can check out our SSL Certificates to provide some level of security.