This site is not affiliated with Cloudflare; this is an independent explanation.
The 520 error code means Web server returned an unknown error. You will not find it in the official HTTP registry. Cloudflare, a service placed in front of many websites, made this code for the cases when the real server replies in a way that Cloudflare cannot understand or does not expect.
Think of Cloudflare as a receptionist. It passes your request to the back office and expects a proper answer. When the back office hands over a blank page, a crashed message or a reply in the wrong format, the receptionist shows you a 520. Because it is a catch-all, the number alone does not name the exact fault, so the fixing happens on the site owner's side.
Common causes
1Site script crashed and sent an empty reply
How to tellError began right after a code, plugin or theme change
What fixes itOwner undoes the recent change and reads the error log
2Origin server dropped the connection mid reply
How to tellSome pages work, one heavy page always fails
What fixes itOwner checks memory and process limits on the server
3Response headers are too large or invalid
How to tellLogin or cart pages fail while simple pages load
What fixes itOwner trims cookies and headers sent by the application
4Firewall or security tool cut the request
How to tellFailure begins at busy times or after a security rule update
What fixes itOwner allows Cloudflare addresses and reviews the rate limits
5Origin server restarting or overloaded
How to tellError comes and goes within minutes
What fixes itWait and retry; owner adds capacity if it repeats
6Cached bad page in your browser
How to tellOther people can open the site but you cannot
What fixes itUse a private window, then clear the site's cache and cookies
How to fix it, step by step
Reload after one minute
A restart or a short crash can produce a single 520 that vanishes soon after. Wait a minute, then reload once with Ctrl + F5, or the reload button on a phone.
Open the site in a private window
This skips saved cookies and cached files. If the site opens in the private tab, the problem is a stored item in your normal browser, and clearing the cache for that site is enough.
Compare Wi-Fi and mobile data
Switch networks and try again. A 520 that follows you across networks belongs to the website. One that only shows on a single network may come from a filter, a proxy or a blocked address range there.
Check another page on the same site
If the home page opens and only one page fails, the fault sits with that page's script. You can use the rest of the site and tell the owner which page to look at.
Ask someone else to try
If friends on other networks also see the 520 code, the site is failing for everyone and you can stop troubleshooting your side.
Tell the site owner and try later
Send a screenshot with the time and the page address through their social media or contact option. Come back after an hour or two.
Owners: look at the origin error log
The server log at the exact time of the error usually names the script or process that failed. Fix that, then reload the page to see whether the 520 clears.
Understanding the 520 error code
Several cases land in this one bucket: an empty response, a response with a missing or oversized header, a connection closed before the reply ended, or a reply that is not valid HTTP. The Cloudflare documentation treats 520 as a sign that something on the origin side behaved oddly. The bucket is wide, so looking at the origin's own logs matters more than guessing.
You open an online form and see Error 520: Web server returned an unknown error with Browser and Cloudflare marked working and Host marked with an error. The host is the part that answered badly.
520 compared with 521, 522 and 502
| Code | What the origin did |
|---|---|
| 502 | Sent a reply the gateway could not use |
| 520 | Sent an empty, broken or unexpected reply |
| 521 | Refused the connection |
| 522 | Stayed silent until the wait ran out |
Details for error 521, error 522 and 502 Bad Gateway are on their own pages, and every code is listed under HTTP status codes.
Is a 520 error a sign the site is hacked?
Not by itself. Bugs and traffic spikes cause far more 520 errors than attackers do. If a site also shows odd content, strange redirects or warnings from your browser, that is a separate sign and the owner should scan the site. A plain 520 on its own is a technical reply problem.
Never enter passwords or payment details on a page that looks different from usual after an error. Return later, or use the company's app if there is one.
How site owners fix a 520
- Read logs first at the origin for crashes, fatal script errors or restarts around the time of the failure.
- Reduce header size by removing extra cookies or long custom headers that the application adds.
- Check resource limits for memory, processes and open connections on the host.
- Test the origin directly, bypassing Cloudflare, to confirm it returns a normal page.
- Contact Cloudflare support with the ray ID shown on the error page if the origin looks healthy.
Frequently asked questions
What does error code 520 mean?
It means Cloudflare got an unknown, empty or unexpected reply from the site's own server. It is a Cloudflare code, not a standard HTTP one.
Is the 520 error code my fault?
Rarely. The problem lies between Cloudflare and the origin server. A stale cache in your browser is the only common cause on your side.
How long does a 520 error last?
A one-off crash clears in minutes. A bug in the site's code or settings lasts until the owner fixes it, which can take hours.
What is the error code: 520 ray ID?
The ray ID is a reference number printed on the error page. Site owners can give it to Cloudflare support so that the exact failed request can be traced.
What is the difference between 520 and 502?
A 502 is a standard code for a bad reply behind a gateway. A 520 is the Cloudflare version used when the reply is empty, malformed or otherwise unknown.