Suddenly started getting numerous 520 errors

I’ve suddenly started getting numerous 520 errors in the past 2 weeks, seemingly out of nowhere.

This affects my subdomain. The errors are listed as “CORS Missing Allow Origin” in my browser network tab in devtools.

When I pause Cloudflare all 520 errors cease, however they persist when running Cloudflare’s development mode. This leads me to believe this is a Cloudflare issue and not an issue at my origin server.

Example Ray IDs


same problem here
also they asked me to buy their load balancing service to restore 100% uptime

I would advise you to remove cloudflare temporarily and see if your site runs better without cloudflare

if cloudflare makes sites slower rather than faster then I don’t see the point

1 Like

Performance is generally fine - but the constant 520 errors obviously isn’t helping. Low traffic, high traffic - doesn’t make a difference. The 520s are consistent. Pausing Cloudflare fixes it, but I require the SSL Cloudflare offers on my top-level domain so without migrating completely away from Cloudflare I’m not able to pause for any length of time…

1 Like

I hope Cloudflare responds because I too face 5xx errors that are inexplicable. Hosting vendor doesn’t see issues, log files don’t show issues, yet monthly report from Cloudflare says there are 5xx errors.

Same problem here - site down - now no webste… and not able to get suport from Cloudflare

Sounds like a few of us are having these problems, with no obvious solution.

Ticket number 2262375


1 Like

There are some mitigation steps at the bottom of this page that you could try: How to Fix "Error 520: Web Server Is Returning an Unknown Error"

These 520 errors cease when I pause Cloudflare - therefore I don’t believe the issue is at my origin server but on Cloudflare itself.

1 Like

We are also having the same problem. In the last 3 hours, we have seen 520 and 524 Errors. Right now we are migrating all of out websites from Cloudflare.

If you are sure your origin is not returning malformed responses, even occasionally, then you should make sure you have appropriate CORS headers. Specifically for APIs, read all the answers below carefully: vue.js - CORS Missing Allow Origin - Stack Overflow

Hello, if you get a resolution, please post resolution. Thank you, Jim

I’ve double checked - my origin server is setting all CORS headers correctly.

My only workaround for this is for my code to re-request any API requests that return a 520. As these errors are so sporadic, the second attempt is nearly always successful. It doesn’t feel like a satisfying solution as it’s not solving the route cause at all - that Cloudflare is failing to always send the correct CORS headers for reasons that remain unknown…

Did you make sure to answer any OPTIONS requests with the correct CORS header as well?

Yes - although the 520 errors appear to only affect POST requests.

I’m going to suggest one more thing to test: add a global CORS header to all requests inside your server config. I think you are on Heroku, so you should be able to add the rule to your static.json iirc (or otherwise .htaccess or the like). Even your 404s should have a CORS header in this case.

All requests have CORS headers set. Sadly, the problem still persists… :slightly_frowning_face:

Sure? doesn’t have a CORS header right now. See if you can add it at the server level, so every single request has a Access-Control-Allow-Origin: * header (to test).

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.