Have you ever encountered a mysterious error message while browsing the web? Maybe it looked something like “520 Error,” “520 Code,” or “520: Web Server is Returning an Unknown Error.”
This Cloudflare error looks like a code from another planet, but don’t worry. We have some explanations for why you’re seeing it.
If you’re a web developer with access to your website’s web server, this is the perfect article for you. We’ll help you to understand the 520 error code and how to fix it.
- DNS, CDNs, and Firewalls
- What Is the 520 Status Code?
- Common Causes for the 520 Error Message on Your Web Server
- How to Fix the HTTP 520 Error
- How to Prevent 520 Errors in the Future
DNS, CDNs, and Firewalls
Understanding DNS, CDNs, and firewalls is key to better understanding why 520 errors happen.
DNS, or Domain Name System, is the Internet’s phone book. It translates human-friendly domain names like www.example.com into IP addresses that computers use to talk to each other on the network.
Without DNS, navigating the web by remembering strings of numbers would be impossible. Proper DNS configuration ensures your website visitors are directed to the right server, which is important for smooth and error-free operation.
CDNs, or Content Delivery Networks, are systems of distributed servers that deliver web content to users based on their location. By caching content closer to the user’s location, CDNs reduce latency and load times. This improves the user experience and helps manage large traffic and sudden spikes.
CDNs act as a middle person between the user and the origin server, and any miscommunication or configuration issue between these layers can cause 520 errors.
Firewalls are security systems that monitor and control incoming and outgoing network traffic based on set security rules. They act as a barrier between your internal network and external sources, protecting your server from unauthorized access and cyber threats.
Firewalls can block malicious traffic but can also block legitimate requests if not configured correctly. Make sure firewalls are set up to allow essential traffic, such as requests from a CDN like Cloudflare, to ensure your website is always accessible and error-free.
What Is the 520 Status Code?
The 520 code, also known as the 520 status code or HTTP status code 520, is an error message delivered by a web server. It indicates that the server received a request from your browser but couldn’t complete the connection and send back the information you requested.
These status codes indicate the result of a browser’s request to the server. The 520 status code is a bit different from other more common status codes like 404 (Not Found) or 500 (Internal Server Error).
The HTTP status code 520 is classified as “Web Server Returned an Unknown Error.” This code is typically associated with Cloudflare’s content delivery network (CDN) service.
It’s often considered a catch-all response, meaning the web server did something unexpected, resulting in an empty or invalid HTTP response.
When you see an HTTP status code 520, it means that the web server has returned an unexpected or unknown response to Cloudflare, which acts as an intermediary between the client (your browser) and the web server hosting the website.
Other popular status codes include:
- 200 OK: Everything went smoothly, and the website content is ready for you to see.
- 404 not found: The specific webpage you requested couldn’t be found on the server.
- 500 internal server error: Something went wrong on the server’s side, preventing it from fulfilling your request.
Common Causes for the 520 Error Message on Your Web Server
There are several reasons why the 520 error occurs. Here are some of the most common culprits:
- Server overload: Sometimes, the web server might be overloaded with too many requests at once. In case of a server overload, it might be temporarily unavailable, leading to a 520 error.
- Application issues: The software running on the server could be malfunctioning or buggy. This can cause the server to send back an incomplete or invalid response, resulting in the 520 error. In some cases, this may lead to an empty response from the server.
- Incorrect server configuration: Just like a car needs proper tuning for optimal performance, web servers need to be configured correctly. Misconfigurations in server settings can disrupt communication and lead to the 520 error. The origin web server might fail to finalize the request, causing this error.
- DNS issues: The Domain Name System (DNS) acts like the internet’s phonebook, translating website names (like www.example.com) into numerical addresses that computers can understand. If the DNS settings are incorrect, your browser might be sent to the wrong server altogether, leading to a 520 error. Imagine calling the wrong phone number – you won’t reach the intended recipient.
How to Fix the HTTP 520 Error
Now that we know what the 520 error code is and why it happens let’s get to the fix. The solution will vary depending on the cause, but these general steps should help. Understanding the process is key to fixing the 520 error.
Check Your Origin Server
First thing in the troubleshooting process is to check if your server is up and running and configured correctly. When talking about websites that are behind global CDNs like Cloudflare, an origin server is the server that holds the original copy of your website. To access that, you’ll need the web host account information.
Once you log into your web hosting account and select to work on your website’s server, check the firewall settings and look in the error logs for any abnormalities there. Some web hosts might allow you to restart Apache or PHP, potentially fixing the issue.
Check Your Cloudflare DNS Records
Log in to your Cloudflare account and check your DNS Records. Make sure your DNS is correct and your domain points to the right IP in your web host’s domain management system.
Check Your Network
Make sure all network devices are working correctly. Use the network tab in browser developer tools to debug. If using a proxy server, check its config. Tools like traceroute and cURL can help you debug the path to your server and the server response.
By doing this, you should be able to find and fix the 520 error.
Contact Your Hosting Provider
If the issue continues, contact your hosting provider with details about the 520 error, including server logs, network logs, and traceroute results. Open a support ticket and ask for help. However, the most important step is to log into your Cloudflare account and contact their support.
Ready to launch your business online? EasyHosting is here to help. Create your website with our simple-to-use Website Builder and professional templates.
Contact Cloudflare Support
Since the issue is mainly tied to Cloudflare, it makes sense to go there as your last resort if your web host sees that everything is fine on their end. Provide a full description of the issue and any diagnostic info. Work with their support team to fix the issue.
How to Prevent 520 Errors in the Future
You can try to prevent this error from appearing in the future by ensuring your server configuration is correct. Then, try configuring your settings inside your Cloudflare account. A good starting point is to fine-tune your Cloudflare cache from the caching tab and create cache rules.
Collaborate with Your Web Host and Cloudflare
Stay informed about updates from your hosting provider and Cloudflare, and engage proactively with their support teams to address potential issues before they escalate.
Conclusion
The 520 status code or HTTP 520 error is really annoying for website owners and users. But knowing what it means and how to fix it can go a long way in keeping your site up.
Follow this post and be prepared, and you’ll never see the 520 error code again.
Remember, the key to fixing and preventing the 520 status code is server management, monitoring, and communication with your host and Cloudflare.
Need a new website? Join EasyHosting to try our website plans, business email, and domains today! Contact us at support@easyhosting.com or call us at 1-888-390-1210 to find out more.