Key highlights
- Cloudflare error 520 occurs when Cloudflare receives an unexpected response from the origin server, leading to site inaccessibility.
- Misconfigured DNS settings, firewall blocks, server crashes and network issues can trigger this error.
- Using cURL tests, disabling .htaccess and pausing Cloudflare help identify deeper server-related problems.
- To fix error 520, you need to identify the root causes, tweak server settings, and ensure reliable hosting.
Introduction
Have you ever tried to visit your website, only to be greeted by the frustrating Cloudflare Error 520? It’s annoying, right? One moment, everything’s fine, and the next, your site won’t load because Cloudflare is receiving an unexpected response from your server.
This can lead to downtime, lost visitors and even SEO issues if left unchecked. But don’t panic! The good news is that you can fix error 520 by identifying the root cause.
Is it a server crash, a misconfigured firewall, or DNS settings gone wrong? We’ll help you figure it out.
This guide will take you step by step through the troubleshooting process so you can fix the error, prevent future issues, and keep your website running smoothly.
Let’s get started!
How to fix error 520 – Step-by-step guide?
Step 1 – Check server status
- Log into your hosting control panel or SSH terminal.
- Navigate to the error log files (For example, Apache’s error_log or Nginx’s error.log).
- Look for entries related to connection resets, unexpected responses or timeouts.
- Identify any application crashes or missing resources like files, scripts or configuration elements the server expects but cannot locate.
- Take corrective actions such as restarting services or updating software.
Also read: How to Access Cpanel Error Logs for Troubleshooting
Step 2 – Review DNS settings
- Open your Cloudflare dashboard and go to the DNS settings.
- Verify that the A record and CNAME record match the details provided by your hosting provider.
- Ensure the proxy status is correctly set (Orange Cloud for Cloudflare protection, Gray Cloud for direct traffic).
- Check if the TTL (Time-To-Live) values are correctly set for better resolution speed.
Also read: What is DNS (Domain Name System) and How Does it Work?
Step 3 – Inspect Firewall and security settings
Firewall and security configurations can sometimes block Cloudflare’s request headers or interfere with incoming requests, leading to Cloudflare error 520.
- Check your web server Firewall rules to ensure Cloudflare’s IP addresses are not blocked.
- Verify that security plugins or server-level protection systems do not mistakenly flag Cloudflare’s requests as malicious.
- Allow Cloudflare IP addresses in your server settings to prevent unexpected blocks.
- Review the server’s error logs to detect if a security rule is triggering the error message.
If an unexpected response occurs after adjusting security settings, try temporarily disabling Cloudflare and testing the origin server response directly.
Step 4 – Clear browser cache and cookies
Your browser may be storing outdated or conflicting data, causing Cloudflare error 520 when trying to load the web page.
- Open your browser’s settings and navigate to the caching tab.
- Clear cache, cookies and site data.
- Open an incognito/private browsing window and check if the error persists.
- If the issue is resolved, consider implementing cache rules to prevent frequent errors.
Step 5 – Disable .htaccess temporarily
- Connect to your server using FTP or SSH.
- Locate the .htaccess file in the root directory.
- Rename it to .htaccess_backup.
- Check if the site loads properly after this change.
- If the issue is resolved, review .htaccess rules for misconfigurations before restoring.
Step 6 – Check server logs for errors
Analyzing the server’s error logs can help identify the root cause of the issue on the origin web server.
- Check the error log for empty responses, request failures or high latency.
- Review HTTP status codes and find any anomalies in response headers.
- Compare timestamps of incoming requests with logs to pinpoint when the error occurred.
If the error description suggests server overload, optimize your origin server by upgrading resources or configuring better timeouts.
Step 7 – Test server response with cURL
The cURL command helps check how the origin web server responds to Cloudflare’s requests.
Run the following command in your terminal:
curl -I --resolve actualdomain.com:80:YOUR_SERVER_IP http://actualdomain.com
Replace [actualdomain].com with your actual domain and YOUR_SERVER_IP with the correct server IP.
- If you receive an HTTP error or no response, the issue is likely with your web server.
- If the response is normal, Cloudflare might be blocking the request due to security settings.
Step 8 – Pause Cloudflare and check the origin server
- Log into your Cloudflare dashboard.
- Under Overview, select Pause Cloudflare on Site.
- Access the website directly via its IP address to check if the origin server is responding correctly.
- If the error persists, troubleshoot the issue on the hosting provider’s side.
Also read: A detailed guide on using Cloudflare
Step 9 – Contact your hosting provider
If you’ve tried all troubleshooting steps and the Cloudflare error 520 persists, the issue may be with your origin server. Your hosting provider can help diagnose deeper server-level problems.
If using Bluehost:
- Reach out to Bluehost’s support team for assistance in reviewing the server’s error logs, checking for unexpected responses and verifying Cloudflare’s request headers.
- If your origin web server is overloaded or misconfigured, Bluehost’s experts can help optimize resources or recommend managed hosting solutions to improve performance and reliability.
- Ensure that your server’s Firewall settings aren’t blocking Cloudflare IP addresses and confirm that there are no missing response headers in the HTTP response.
Read more: What is Managed WordPress Hosting? And Do You Need It?
Why choose Bluehost as your hosting partner?
Many Cloudflare error 520 issues stem from server misconfigurations, resource limitations or unexpected connection failures on the hosting side. Choosing Bluehost as your reliable managed hosting provider can help prevent such errors by ensuring the following:
- Optimized server environments with stable configurations to reduce error 520 occurrences.
- Managed hosting solutions that handle updates, security patches and server monitoring, ensuring smooth performance.
- Proactive troubleshooting with 24/7 expert support to resolve connectivity issues between your origin server and Cloudflare.
- Scalable hosting plans that prevent server overload, ensuring your site runs efficiently under all traffic conditions.
With Bluehost managed hosting, you get a solution that minimizes server-related errors, improves uptime and provides expert assistance whenever needed. If Cloudflare error 520 is affecting your site’s reliability, partnering with us ensures a stable, high-performance hosting environment.
How to prevent future Cloudflare 520 errors?
Regular server maintenance
Perform routine server maintenance to keep your website running smoothly. This includes:
- Updating software: Regularly update your web server, CMS, plugins and other applications to ensure security and compatibility.
- Firewall checks: Ensure your Firewall settings are correctly configured to allow legitimate traffic while blocking potential threats.
- Resource monitoring: Track CPU, memory and disk usage to prevent server overloads and unexpected crashes.
- Database optimization: Periodically clean up unused data and optimize database queries to improve performance.
Monitor server performance and logs
Regularly reviewing performance metrics helps detect potential issues before they escalate into 520 errors. Follow these instructions to stay in the clear:
- Enable logging: Ensure that your web server’s error logs and access logs are enabled.
- Analyze logs regularly: Check for repeated errors, slow response times and failed requests.
- Use monitoring tools: Tools like New Relic, Datadog or server-native monitoring solutions can help provide real-time insights.
- Set up alerts: Configure alerts for unusual traffic spikes, excessive error rates or server downtime so that you can act quickly whenever issues arise.
Configure appropriate timeout settings
Adjust your server timeout settings to prevent connection interruptions that might cause Cloudflare to return a 520 error:
- Increase timeout values: Set higher timeout limits for PHP, Apache or Nginx to accommodate slow responses.
- Optimize application response time: Identify slow database queries or inefficient code that might delay responses.
- Configure keep-alive settings: Ensure that persistent connections are allowed to improve data transfer efficiency.
- Test with different settings: Gradually adjust timeout settings and monitor the impact on the performance to find an optimal balance.
Final thoughts
A Cloudflare 520 error may seem like a frustrating roadblock, but with the right troubleshooting approach, it’s a problem you can solve. By identifying the root causes, tweaking server settings and implementing proactive measures, you can keep your website stable, accessible and error-free.
Preventing future errors isn’t just about quick fixes. It’s about building a reliable foundation for your site. If you want to avoid the hassle of going into technical troubleshooting by yourself, Bluehost can ensure 100% uptime and dedicated support with our hosting.
To know more and make your website free from future errors, host your website with Bluehost.
FAQs
Cloudflare error 520 occurs when the origin server returns an unexpected response or no response to Cloudflare’s request. It can be due to Firewall blocks, server crashes, misconfigurations or network issues.
Cloudflare itself doesn’t cause error 520, but it may expose server-side issues. If security settings interfere with requests, pausing Cloudflare and checking the server response can help identify the problem.
If your Firewall is blocking Cloudflare, you might notice intermittent connectivity issues or receive error 520. To check:
1. Review Firewall rules: Examine your Firewall settings to see if Cloudflare’s IP ranges are being blocked or rate-limited.
2. Consult security plugins: Some security plugins may have settings that inadvertently block Cloudflare. Review and adjust these settings as necessary.
The time required to fix error 520 depends on the root cause of the issue. If it’s a simple misconfiguration, such as incorrect DNS settings or a temporary server overload, the problem can be resolved in a few minutes by adjusting the necessary settings.
However, if the issue is related to deeper server errors, such as application crashes or blocked Cloudflare IPs, troubleshooting may take longer. In such cases, reviewing server logs and working with your hosting provider can speed up the resolution process.
Yes, a reliable hosting provider with optimized servers can reduce error 520 occurrences. If your server often crashes or lacks resources, switching to Bluehost managed hosting can help ensure stability and better performance.