Sometimes a CF 520 error

I would like to think we’re not that bad.

The majority of 520s are caused by issues on the origin, not with Cloudflare. At no point have we said that a Cloudflare issue is not possible. It is entirely possible that there is an issue there, or all these errors could be unrelated as we have seen here before.

As I have said several times

We have already escalated it here, staff have responded but there is a limit on how much the community can help in this case. If you want this to be investigated by staff, you need to open a ticket about it. Only general troubleshooting information can be shared here.

3 Likes

Requires PHP 7.4 with needed modules.
Not all plugins/themes are compatible yet with either that PHP or WP version.

Just in case, there were topics here how to properly setup Cloudflare with WP Rocket (if using this combination).

Furthermore, if I can share few things with which I experienced a Cloudflare 520’s few times in the start, as of:

  1. Using Flexible SSL option rather than Full (Strict) SSL - neither having an SSL certificate and HTTPS over 443 port at my server at first
  2. Not allowing Cloudflare IP’s at iptables (hopefully saving them to apply) and firewall
  3. Not having the “real visitor IP” setup propperly at Nginx web server for Cloudflare
  4. While modifying my PHP files, due to PHP-OPCache, while restarting PHP service at my server, which then in a moment catched the “error 520” as in the moment of restart I requested a webpage which was not re-generated and saved, neither served via the server as not being in the PHP-OPCache yet at that moment, etc.
  5. Having some issue between a switch of my dedicated server provider and Cloudflare, including few other people at the same hosting provider (there was a topic about it)
  6. Running WordPress with 8k+ daily visitors without using some WP cache plugin like W3TC + Cloudflare
  7. Tuning my WordPress and PHP settings for better performance and lower CPU, RAM and network usage, etc.
  8. Running a WordPress/WooCommerce on a shared cPanel hosting, where I was limited by the I/O, and memory per PHP process
  9. Running a WordPress site on a shared cPanel hosting with it’s cPanel SSL certificate, while the hosting was running Nginx and some “nginx static cache” (probbably their not so well configured Nginx over Apache using fastcgi)
  10. Running Imunify360 WebShield service (standalone installation, no panel) at my origin host, which was being enabled by default and not configuring it by adding domains and their SSL certs and keys to it which resulted as 520s too for each of the domain on the server(s)
2 Likes

I certainly didn’t mean you personally - sorry if my frustration with cloudflare not doing anything about a bug crippling many websites for over two weeks now spilled over onto those community members who really want to help.
I can’t open a ticket because I’m on the free plan and I only have two options: write here or vote with my feet. Or maybe if I upgrade to paid plan the issue will magically go away?
Here’s a screenshot from right now:

1 Like

Thank you.

I’m still not convinced of a bug in Cloudflare because of the difference in behaviour between the sites reporting this issue here. I’ll check up on the escalation and add your domain there to see if the issue can be compared to @clay.aar’s to see if there are any similarities or if they are unrelated.

3 Likes

I am willing to help with analyzing the difference in behavior. Here are the reports:

What difference in behavior?

1 Like

@domjh and @1blas
DirectAdmin forum they have already identified the issues. See this topic: How to reinstall CSF into DA? | DirectAdmin Forums

In this topic, users Beansbaxter says in post #26 that switching from Apache to Nginx was the solution for him. So we can conclude that certain Apache settings are involved. In other topics on the forum I read that LiteSpeedwebserver in the past has also led to similar problems.

Adapting from Apache to Nginx is not always easy, but it clearly indicates that the problem lies with Apache.

Indeed, it doesn’t have to be a CloudFlare bug, but maybe CloudFlare’s developers have made some optimizations that conflict with a standard Apache from DirectAdmin. I’m not very familiar with the exact working of Apache on keep-alive, but I do read a bit about .ipv4.tcp_keepalive settings, and I think that’s where the trouble lies.

I hope the CloudFlare developers will look into this.

Now that the 520 error seems to be getting more clarity, I wonder whether a separate error code can be created for it. There is no longer an Unexpected Error in this situation. :wink:

I don’t have a test environment ready at the moment because I still have some troubles with my registrar, and adjusting the name servers. Very tiring :wink:

1 Like

@clay.aar Just to clarify, do you still get those 520 errors?
For the record, my hosting provider hasn’t updated Apache in months (the current version 2.4.48 was released and installed two months ago) and I’m pretty sure they are not using DirectAdmin. Also, I have read elsewhere that someone downgraded their Apache from 2.4.48 to 2.4.46 just to test and the 520 didn’t go away.

1 Like

Don’t know.
I have now disabled CloudFlare, and i will setup a testlocation of my site on CloudFlare.
But my domain-registrar has problems with changing the nameservers…
Later this day i will try it again…

But one thing is for sure: I didn’t make any changes to my server around the time the problem started.

1 Like

Thank you. I wonder how many more posters in this thread have voted with their feet as well. This could explain their silence.

1 Like

I also disabled Cloudflare today, it was a 520 “party” today. Also moved two sites away and use another dns provider with cdn.

2 Likes

same issue here,
It work after turn off the orange cloud.

1 Like

We must be all hallucinating here - according to Cloudflare the issue was fixed two days ago: https://community.cloudflare.com/t/increased-http-520-errors/292627 :wink:

2 Likes

Yeah, yesterday I clicked a lot and was happy to see it fixed. To soon… I tried also your Art website and didn’t get a 520 error.

1 Like

It doesn’t happen all the time but when I’m working on the site intensively I inevitably get to see either a page, or an AJAX response or a couple of images resulting in a 520. Every time I tried to look up those requests in the web server log, they were not there. All adjacent requests before and after are there, but those CF returns 520 on don’t seem to even reach the web server.

1 Like

What great news to report that the 520 errors have been investigated.

I’ve finally (!) running the test environment of my site on CloudFlare, and after some clicking around I don’t see any strange Cloudflare 520 errors.

Tomorrow I’m going to put my site in production back on CloudFlare. I’m curious!

Update:
I cheered too early. In my test environment i get the 520 error:
RayID: 67bab0d2cc822b16 (Colo: Frankfurt)

I do notice that it happens less quickly than before. But I don’t know yet if this will change.

1 Like

Do you see this request in your web server log?

@marassa Nope, i don’t see the request in my Apache error_log and alsno not in my access_log. Or would there be another log that might be of interest?

For now it’s clear that the request is never reached by my web server. :face_with_monocle:

1 Like

Unfortunately I’m out of my depth here not being a network admin. Theoretically a network packet could make it to the host but never reach the web server (Apache) for some reason. Or Apache itself could mysteriously drop the packet before logging it. But debugging this kind of things is way above my pay grade…
PS Here’s what I don’t understand:
“A 520 error occurs when the connection started on the origin web server, but that the request was not completed… When this happens, you’ll see “Error 520: Web server is returning an unknown error”.”
If the web server won’t admit ever receiving the request, who’s "returning an unknown error”?

I’ve been having this problem too for the past few weeks. Random 520 errors, and when users refresh, the pages appears normal. There are no errors in the logs to indicate any issues.

I’ve also come across it randomly while browsing the web myself.

This is a Cloudflare bug. I hope someone notices and fixes it, because there’s nothing we can do other than disable it.

These random 520 errors started happening around the week of July 22, and sometimes they get worse, but they never go away. The errors are completely random too. Nothing in the server logs, error logs, domain logs, etc.

And nothing has been changed on the sites/servers for a good 6 to 12 months.

Turning off Cloudflare solves the problem.

I wish Cloudflare would give more guidance to the errors. The current 520 error is simply too ambiguous and does nothing to help bring resolve to a frustrating random situation.