How to Fix Cloudflare Error 520 (Web Server Returned an Unknown Error)
Cloudflare Error 520 means Cloudflare reached your origin server but got back an empty, unknown, or malformed response. It affects anyone trying to load your site, and it points to a problem on the server, not on Cloudflare. The good news: it is almost always fixable once you know where to look. If the trouble turns out to be your SSL setup, our guide on Let’s Encrypt SSL can help too.
What the error means
Cloudflare sits between your visitors and your web server. When someone opens your site, Cloudflare asks your origin server for the page and passes the reply back. Error 520 appears when that reply makes no sense to Cloudflare: it is empty, the HTTP headers are broken, or the connection drops mid-response. In short, Cloudflare did its job, but the origin returned something it could not read. That is why a 520 is an origin-side issue, even though Cloudflare shows the error page.
Common causes
- The web server or PHP process crashed and returned nothing.
- The application ran out of memory or hit a resource limit.
- Response headers were too large, often from oversized cookies.
- The origin dropped the connection before it finished replying.
- A server firewall or security tool, such as CSF or mod_security, blocked Cloudflare’s IP addresses.
- The server sent a missing or malformed HTTP response.
How to fix it
Start by finding out whether the site works without Cloudflare in the way. That tells you fast if the origin is the problem. Then work through the server itself.
- In your Cloudflare dashboard, open DNS and set the record for your domain to DNS only by clicking the orange cloud so it turns grey. Load the site again. If it works now, the origin is returning a bad response.
- Prefer not to change DNS? Point your computer at the origin IP with a hosts file entry and test that way.
- Check the server and PHP error logs for the moment the error happened. They usually name the crash or limit.
- Restart PHP and the web server to clear a stuck process.
- Confirm the account is not out of memory or other resources.
- Allow Cloudflare’s published IP ranges in your server firewall so nothing blocks them.
- Reduce oversized headers and cookies, which can push a response past the size limit.
- Switch the cloud back to orange once the site is stable.
On JetHost hosting
On JetHost, open cPanel and check Resource Usage first. It shows whether your account hit a CPU, memory, or process limit at the time of the error, which is a common cause of a 520. Make sure Cloudflare’s IP ranges are not blocked by the firewall. Our stack runs on LiteSpeed, so a stuck request often clears with a restart. If you cannot find the cause, open a ticket: our support team can read the origin logs and tell you what the server returned.
JetHost Experts Tip
Set your DNS record to DNS only for a few minutes to test the origin directly. If the site loads, you have confirmed the fault is on the server, not Cloudflare.
Frequently asked questions
No. A 520 means your origin server returned an empty or malformed response. Cloudflare only reports it. The fix is on the server side.
Set the DNS record to DNS only (grey cloud) in Cloudflare, or add a hosts file entry pointing to your origin IP, then load the site. If it works, the origin was returning a bad response.
Yes. Very large cookies or response headers can push the reply past the size limit, which Cloudflare reads as a malformed response. Trimming them often clears the error.
New Hosting Plan with 80% OFF
Upgrade your website’s home without the heavy bill. Get new hosting plan with a huge 80% discount. Get free SSL, email accounts, and a control panel to manage your site. Enjoy fast performance, secure environment, and 24/7 support – all in one affordable package.
Need more help?
Still stuck? Open a ticket through Client Area, then Support Tickets, and our team will check the origin logs with you.


