Key takeaways
- Error 520 is triggered when Cloudflare can’t understand the response from your website’s server.
- Resolving the issue involves checking server logs, reviewing firewall rules, and correcting configuration errors.
- You can prevent Error 520 by maintaining a stable hosting environment and allowing traffic from Cloudflare’s IP addresses.
Encountering Error 520 on your website can be confusing and frustrating. This error is unique to Cloudflare and typically indicates that Cloudflare was unable to establish a proper connection with your original server.
Despite the message’s vagueness, the underlying causes are usually identifiable and fixable.
In this guide, you’ll learn:
- What does Error 520 mean
- The most common causes behind it
- How to diagnose and fix the issue
- How Error 520 differs from similar errors like 521 or 522
- When it’s time to escalate the issue to your hosting provider or Cloudflare support
If your site is currently displaying this error, the sections below will help you troubleshoot and resolve the issue.
What is error code 520?
Error 520 is a special error used by Cloudflare. It means Cloudflare attempted to connect to your website’s server but didn’t receive the expected response. This unexpected response can manifest as a connection reset, a connection timeout, or an empty response from your origin server.
Many websites utilize Cloudflare to enhance their site’s speed and security. Cloudflare sits between the visitor and the actual server where your website lives. It helps manage traffic, blocks threats, and speeds things up.
However, sometimes when Cloudflare attempts to connect to your server, the server either fails to respond or sends back unexpected data. When that happens, Cloudflare doesn’t know what to do. Instead of displaying your website, it shows Error 520.
Think of it like making a call, and the connection is established, but no one speaks. Just silence. That is what’s happening between Cloudflare and your server.
This error matters because:
- It prevents users from accessing your site.
- It’s hard to know exactly what went wrong.
- Fixing it often requires checking the server, which can take time.
Unlike common HTTP errors like “404 Not Found” or “500 Internal Server Error,” Error 520 is unique to Cloudflare. It doesn’t exist in the standard list of HTTP status codes. Cloudflare created it to represent a wide range of edge-case responses that don’t fall under more specific errors.
How Error 520 differs from other 5xx errors
Although Error 520 falls under the “5xx” server error category, it is Cloudflare-specific and differs from standard HTTP codes errors. That means you won’t see it unless your site is using Cloudflare’s services.
Here’s a comparison:
Error code | Who generates it? | Meaning | Common causes | Cloudflare-specific? |
520 | Cloudflare | Unknown error from origin server | Empty or invalid server response, headers too large, firewall blocking Cloudflare | Yes |
500 | Origin server | Internal server error | Code bugs, misconfigured .htaccess, unhandled exceptions | No |
502 | Cloudflare (or other proxy) | Bad gateway | Origin server returned an invalid response | Yes |
503 | Origin server | Service unavailable | Server overload, maintenance mode | No |
504 | Cloudflare or gateway | Gateway timeout | Origin server didn’t respond in time | Yes |
So, while all these errors suggest something is wrong on the server side, Error 520 stands out as Cloudflare’s way of saying, “Something strange came back, and we don’t know how to handle it.” It’s a catch-all for unexpected responses that don’t fall under more specific error categories.
What causes Cloudflare Error 520?
Now that you know what Error 520 is, here are the common causes behind why it happens:
- Unexpected or empty responses. The server might reply with a response that’s missing key parts, like the status code or body. When that happens, Cloudflare doesn’t know how to handle that, so it shows an error.
- Server overload. If the origin web server is overwhelmed with too many requests, it might slow down or stop responding altogether.
- Misconfigured firewall or security settings. Firewalls and other security tools might accidentally block Cloudflare’s IP addresses. This can occur if settings are too strict or Cloudflare’s IP addresses aren’t whitelisted.
- HTTP/2 protocol issues. Some servers accept HTTP/2 connections but don’t fully support them. This mismatch can confuse Cloudflare and trigger a 520 error.
- Resource exhaustion (server is out of power). If background tasks, cron jobs, or other processes consume excessive memory or CPU resources, the server may be unable to handle Cloudflare’s requests.
- Connection issues between the server and Cloudflare. Even if your site works fine for users, Cloudflare could still struggle to reach it due to network errors, timeouts, or resets.
- Malformed or oversized HTTP headers. If the server sends headers that are too large or badly formatted, Cloudflare might reject the response.
- Misconfigured server rules (.htaccess or NGINX). Certain server settings might block or interfere with traffic from Cloudflare.
- Crashed web server software. If the software that powers your site,such as Apache or NGINX, crashes or stops responding, Cloudflare can’t connect, and you receive a 520 error.
How to fix error code 520
Fixing error code 520 depends on whether you are a website owner or developer, or simply a visitor to the site. If you’re just visiting the site, you’ll have fewer options—but we’ve got tips for both.
A. For website owners or developers
If you manage or own the website, there are several things you can check and do to fix the issue:
- Check your web server logs.
- Review the firewall or security settings.
- Disable plugins or applications temporarily.
- Check resource limits and server load.
- Look for invalid or oversized headers.
- Reboot or restart the server as a last resort.
Read on for more details!
1. Check your web server logs
Start by checking your server logs. These logs record everything that happens on your server. Look for:
- Errors or crashes that happened around the same time as the 520 error
- Any unusual or unexpected activity
- Requests that may have failed
These clues will help you understand what the server was doing when the error occurred.
How to check your logs:
If you’re using shared hosting (like Network Solutions, Bluehost, or HostGator):
- Log in to your hosting control panel (usually cPanel).
- Look for “Error Logs” under the Metrics or Logs section.
- Check the most recent logs and review entries around the time of the error.
If you’re using a VPS or cloud server with SSH access:
- Connect to your server using an SSH client like Terminal (Mac/Linux) or PuTTY (Windows).
- Use these commands to check for recent errors:
cd /var/log
tail -n 50 apache2/error.log # For Apache
tail -n 50 nginx/error.log # For Nginx
- Replace the log path with your actual server configuration if it’s different.
- Look for signs of failure like timeouts, fatal errors, or memory issues.
If you’re using a control panel like Plesk or Webmin:
- Log in to your control panel.
- Find the logs for your domain or server.
- Focus on the error log and look for any red flags.
Once you’ve found the relevant log entries, you can trace the cause, like a plugin failure, bad request, or overloaded server, and then fix it.
2. Review firewall or security settings
Sometimes, your server’s firewall or security software blocks Cloudflare’s IP addresses, especially if they’re misconfigured or too strict. This can cause Error 520.
Make sure:
- Your firewall or security tools are not blocking or restricting Cloudflare IPs.
- Any rate-limiting or DoS protection isn’t being too aggressive.
Tip: You can find a list of Cloudflare’s IP ranges on their official documentation. Be sure to whitelist those IPs.
3. Disable plugins or applications temporarily
Some plugins or custom apps can act up and break communication with Cloudflare. Here’s how to check:
- Disable all plugins or custom apps temporarily.
- Reload the site. If the error goes away, one of them is the culprit.
- Turn them back on one at a time to find the problem — then you’ve found the issue.
This method helps you identify faulty code that might be causing the error.
Action steps:
If you use WordPress or a similar CMS:
- Access your admin panel (e.g., WordPress Dashboard).
- Go to Plugins → Installed Plugins.
- Deactivate all plugins.
- Reload your site and check if the Error 520 is gone. If the site works now, the issue is likely caused by one of the plugins.
- Reactivate plugins one by one, checking the site after each activation.
- Once the error returns, you’ve found the problematic plugin. You can replace, update, or remove it.
If you can’t access the dashboard (site is down):
- Use FTP or File Manager (in cPanel or your hosting panel).
- Navigate to: /wp-content/plugins/ (for WordPress)
- Rename the plugin folders (e.g., change seo-plugin to seo-plugin-disabled).
- This will force WordPress to deactivate them.
- Try loading your site again.
If you use custom applications or code:
- Review recent changes to scripts or backend code.
- Temporarily disable any newly added modules, APIs, or custom features.
- Restart your application or service and test it again.
4. Check resource limits and server load
Your server may be running out of resources like memory, CPU power, or storage. When that happens, it may fail to respond properly to Cloudflare.
What to check:
- Is the CPU maxed out?
- Is there enough free RAM?
- Is disk space almost full?
Possible fixes if server is overloaded:
- Restart heavy processes like PHP, Apache, or MySQL.
- Upgrade your hosting plan if you’re hitting limits often.
- Use caching plugins to reduce load on dynamic pages.
- Block bad bots or DDoS attempts using server rules or Cloudflare settings.
- Optimize your website’s code, database, and images to reduce resource usage.
If your server is always under stress, it may be time to scale up.
5. Look for invalid or oversized headers
Every HTTP request and response includes something called headers. These contain important information. If your server sends a header that is too large, malformed, or not allowed, Cloudflare may reject the response and trigger Error 520.
To fix this:
- Remove unnecessary or overly large headers.
- Make sure headers follow the correct formatting.
- Avoid including private info in headers.
You can inspect headers using browser dev tools, curl commands, or server-side debugging tools.
6. Reboot or restart the server (as a last resort)
If none of the above helps, try restarting your server. This can reset stuck processes or clear temporary issues.
Just know that rebooting can cause a few seconds of downtime — not ideal if your site gets a lot of traffic. Only do this if you’re comfortable managing the server or your hosting provider allows it.
B. For visitors / end-users
If you’re visiting a site and see a Error 520, you can’t fix the server directly, but you can try a few simple steps:
- Refresh the Page. Sometimes the error is just temporary. Try refreshing or reloading the page after a few seconds. This often solves the problem if it was caused by a quick server hiccup.
- Try accessing the site later. The website may be under maintenance, overloaded, or experiencing a technical problem. Wait a few minutes and then try again. If the issue is on the server side, only the site owner can fix it.
- Contact the website administrator. If the error keeps happening and you need access to the site, contact the website’s support team or owner. Let them know what you saw and when. They may not know there’s an issue, so reporting it helps them fix it faster.
How to prevent Cloudflare Error 520
Fixing Error 520 can be frustrating, especially when it disrupts your site’s availability. That’s why a better approach is to stop it from happening in the first place. Here’s what to consider:
- Use a reliable hosting provider. A weak or unstable hosting environment can cause frequent server crashes or slowdowns. This makes it more difficult for Cloudflare to obtain a proper response from your site. Choose a web hosting provider that is recognized for its reliability, performance, and support.
- Keep your server software and plugins updated. Outdated software can lead to unexpected bugs or broken features. These issues might cause your server to respond incorrectly and trigger Error 520. Ensure that you regularly update your web server (such as Apache or NGINX), your CMS (like WordPress), and any plugins or themes you use.
- Monitor server uptime and performance. Monitor your server’s performance closely. Use tools such as UptimeRobot, Pingdom, or your hosting dashboard to track uptime, speed, and resource utilization. If your server becomes overloaded or starts failing, you can resolve the issue before it impacts Cloudflare’s connection.
- Whitelist Cloudflare IP addresses. Your server might block Cloudflare by mistake, especially if firewall rules are too strict. To avoid this, make sure all of Cloudflare’s IP ranges are whitelisted in your firewall or security software. This enables Cloudflare to safely pass traffic through and avoid broken connections.
- Review your firewall and security settings regularly. Aggressive security tools can sometimes block good traffic. Set aside time to audit your firewall rules, WAF settings, or tools like fail2ban. Make sure they aren’t blocking Cloudflare’s IPs or misclassifying its traffic as suspicious. Adjust settings as needed to strike a balance between security and accessibility.
When to contact hosting provider or Cloudflare
If you’ve gone through the main troubleshooting steps and the Error 520 still isn’t resolved, it’s time to escalate the issue. Depending on the source of the problem, you’ll either need to contact your hosting provider or Cloudflare support.
Contact your hosting provider if:
- Your server is crashing, restarting, or failing to respond to requests
- You suspect a misconfigured firewall or security rule is blocking Cloudflare
- You notice other errors in your server logs that may be related
- You’ve made recent server changes (like updates or code deployments) before the error started
Your hosting provider can help you access deeper server logs, check for resource limits, and rule out internal server issues.
Contact Cloudflare if:
- Your origin server is working, but Cloudflare still shows a 520 error
- You see intermittent issues with specific data centers or regions
- You’ve already whitelisted Cloudflare IPs and double-checked your firewall
- You need help interpreting Cloudflare-specific logs or analytics
Cloudflare’s support team can help identify whether the issue lies in the connection between their edge servers and your origin.
Make 520 Errors a thing of the past
Error 520 is frustrating— but it doesn’t have to be. If you’re looking for a faster, more reliable way to keep your website running smoothly, it may be time to upgrade your hosting environment.
Explore Network Solutions’ hosting solutions built to work seamlessly with Cloudflare. Better performance. Fewer errors. Real support when you need it. Check out our hosting plans now
Frequently asked questions
Error 520 usually happens when the origin web server sends an invalid response or an empty response to Cloudflare’s requests. It can be caused by server overload, blocked Cloudflare IP addresses, or misconfigured firewall settings on your web hosting account.
Start by reviewing your server logs and error logs through your web hosting account or admin dashboard. You can also use browser developer tools in Google Chrome, specifically the Network tab, to inspect response headers and request headers for issues.
Yes. If your web server is returning an unknown error and you’ve confirmed that your server configuration and DNS settings are correct, you should contact Cloudflare support. Include your actual domain name, an HAR file, and any recent changes to Cloudflare DNS records or the proxy server setup.
Sometimes, yes. Restarting services like Apache, Nginx, or PHP on your website’s server can fix temporary issues. Use commands like restart apache or restart nginx to refresh your server environment and clear any stuck TCP idle timeouts or invalid HTTP responses.
It is a server-side issue. The error happens between Cloudflare and your website’s server, not in the visitor’s browser.