Error 520 is one of the most common Cloudflare errors. It occurs when Cloudflare successfully connects to your origin server, but the server returns an unexpected, empty, or invalid response.
Unlike errors such as 521 or 522, Error 520 usually indicates that the web server is responding, but something is preventing Cloudflare from processing the response correctly.
Table of Contents
What Causes Error 520?
Several issues can trigger Error 520, including:
- PHP application errors
- Server resource exhaustion
- Firewall rules blocking Cloudflare IP addresses
- Corrupted
.htaccessfiles - Invalid HTTP headers
- Large response headers or cookies
- Misconfigured SSL settings
- WordPress plugins or themes generating fatal errors
Check Your Website Without Cloudflare
The first step is to determine whether the problem originates from Cloudflare or your website.
Temporarily pause Cloudflare or switch the affected DNS record from Proxied (orange cloud) to DNS Only (grey cloud).
If the website still displays errors, the problem is likely on the origin server.
If the website works correctly without Cloudflare, continue with the steps below.
Review Server Error Logs
Check your website’s error logs for messages that occurred at the same time as the Error 520 event.
Look for:
- PHP fatal errors
- Memory limit errors
- Timeout errors
- Application crashes
- Web server configuration issues
For WordPress websites, enabling debug logging can help identify the exact cause.
Check Firewall Configuration
A common cause of Error 520 is a firewall blocking Cloudflare’s requests.
Make sure:
- Cloudflare IP ranges are allowed.
- Security tools such as ModSecurity are not blocking Cloudflare traffic.
- Rate limiting rules are not affecting Cloudflare requests.
If your server blocks Cloudflare’s IP addresses, visitors may receive Error 520 even though the website appears to be online.
Verify SSL Configuration
Incorrect SSL settings can cause communication issues between Cloudflare and the origin server.
In Cloudflare, navigate to:
SSL/TLS → Overview
The recommended setting is usually:
Full (Strict)
This requires a valid SSL certificate on the origin server.
Avoid using Flexible SSL unless absolutely necessary, as it can create redirect loops and other unexpected issues.
Disable Problematic Plugins
If you use WordPress, Joomla, PrestaShop, or another CMS, a plugin or extension may be causing invalid responses.
Temporarily disable:
- Security plugins
- Caching plugins
- Redirect plugins
- Performance optimization plugins
Then test the website again.
Check Server Resources
If the server runs out of resources, applications may fail to generate proper responses.
Check:
- CPU usage
- Memory usage
- PHP worker limits
- Entry processes
- Disk space
A server under heavy load may generate intermittent Error 520 messages.
Verify the .htaccess File
Incorrect rewrite rules or redirects can sometimes trigger unexpected responses.
If you use Apache, temporarily rename your .htaccess file and test the website.
For WordPress websites, you can regenerate a clean .htaccess file by saving the permalink settings again.
Clear Cloudflare Cache
Cached responses may continue serving errors even after the underlying issue has been fixed.
In Cloudflare, navigate to:
Caching → Configuration → Purge Cache
You can purge the entire cache or only the affected URLs.
Contact Your Hosting Provider
If you cannot identify the cause, contact your hosting provider and provide:
- The affected URL
- The exact time the error occurred
- The Cloudflare Ray ID shown on the error page
The Ray ID helps administrators trace the request in server logs.
Summary
Cloudflare Error 520 means Cloudflare successfully reached the origin server but received an unexpected or invalid response. The most common causes include PHP errors, firewall blocks, SSL misconfigurations, resource limits, and application-level problems. Reviewing server logs and checking firewall and SSL settings are usually the fastest ways to identify the source of the issue.