Sometimes a CF 520 error

Unfortunately this didn’t solve the problem, and purging the cache didn’t help either. So I turned off CF on this one.

I’m going to involve the test environment, there are no visitors there, and there is less nuisance. Good to try something there and try to reproduce this. But I still believe that this is not because of my server, because it arose spontaneously.

There are four other people in this thread who have reported this problem. So I assume there will be further research within CF? This clearly seems like a serious problem.

I really hope the forum-support has any ideas. Later today I will dedicate another email.
Maybe the senior staff has some ideas. :slightly_smiling_face:

1 Like

I have exactly the same problem with my website for about a week, I am accessing it from Moscow. Sometimes a random page would return 520, sometimes a whole batch of photos in a gallery would not load with a 520. The hosting provider swears that the requests in question do not even reach the host (located in Germany if relevant). Here are some Ray IDs from today:
Switched off Always Online: no improvement
Cookies: there are only two small cookies of my own and three much larger cookies added by CF themselves but nowhere near 32K.
CF IP address that gives trouble most often:

1 Like

@clay.aar and all,

I’m checking with our internal team to rule out any possibilities of this being a Cloudflare issue.

@clay.aar let me know once you have that test environment in place so we can keep testing.

Also, can you check to see if you can compare these logs with the error logs from your server (UTC Time):

	Time	message
	2021-08-05T08:37:07.000Z	stream write failed: -12 while sending to client
	2021-08-04T15:46:09.000Z	stream write failed: -12 while sending to client
	2021-08-03T20:49:22.000Z	stream write failed: -12 while sending to client
	2021-08-02T22:26:12.000Z	stream write failed: -12 while sending to client
	2021-08-02T17:57:02.000Z	stream write failed: -12 while sending to client
	2021-08-01T23:20:32.000Z	stream write failed: -12 while sending to client
	2021-08-01T22:46:54.000Z	stream write failed: -12 while sending to client
	2021-08-01T21:48:33.000Z	stream write failed: -12 while sending to client

A 520 is a generic “catch all” error and typically coincides with an origin issue. However, I am still investigating further here.


Tomorrow I’ll take a look at the test environment. :slightly_smiling_face:

I’ll do some research, but the fact is that without CloudFlare, I don’t have any problems. Everything loads fine. So far, I have not come across these error messages anywhere, at least not in my error_log of my webserver.

Is this the whole log? Or a part of it?
I have encountered the 520 error more than 8 times in the past few days.

Just an idea. Could this also be related to gzip compression on my server?

1 Like

i have the exactly same issue. Our domains and scripts run on cf from many years without any errors. But last week, we have recived seviral (326 times) 520 error.

i checked the server logs and noting found unexpected. Server works fine and there is no network issue.

this is really hard to explain to my managers :frowning:

here is the details;

Cloudflare Ray ID: 67a338180aad1eeb

ip= {redacted}
uag=Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{redacted} Safari/537.36

1 Like

Typically it might well be but when many different origins start showing the same symptoms starting roughly at the same time it suggests a tiny possibility of an issue on the cloudflare side. When a stream write fails sending to client, the problem can be on the receiving OR sending side (or somewhere in between). As I said earlier, my server never even receives the requests cf returns 520 on.
Did you change anything in your software/configuration around two weeks ago? Unfortunately I don’t remember exactly when it started but according to what people write here it seems like around two weeks ago give or take a few days.

1 Like

I’m busy to make a testlocation on a similar domain. The domain on cloudflare has now been created, but unfortunately it seems my registrar has problems with changing the nameservers. :face_with_monocle:

I’ve made a ticket so they can fix it.

To be continued :grinning:

1 Like

Hi all. I don’t know if this is related. But today I have tried one of the sites ( with the frequent problem of the 520

3 clicks and 520 again (Ray ID: 67a9d4164f237527 • 2021-08-06 17:01:40 UTC)

Perhaps there is a relationship in how the SSL certificate is managed between cloudflare and the server.

I changed the SSL encryption mode (flexible to full)

I waited a few minutes. I surfed the site again, making over 70 clicks and no 520 have turned up.

I don’t know if it’s a coincidence, I’ll keep trying.

1 Like

@Ciris My SSL/TLS encryption mode is Full, has been since the beginning. So must be a coincidence, I’m afraid.

1 Like

My SSL-mode was also full.

But on my investigation, i find this topic. Halfway through it’s about the 520 errors.

It seems that DirectAdmin installed servers with Apache are affected. In that topic calls somebody that switching to Nginx resolves the problem. (Not a best solution :sweat_smile:)

Is a setting in Apache probably the problem?
Maybe a keep-alive setting? (See link below to the post) :point_down:

1 Like

Still insecure I am afraid.


I have been using Cloudflare for several years, and never had any problems. And a few weeks ago, random Cloudflare 520 errors started happening.

Server logs show no errors. I’ve checked everything from the system level to the domain level.

Always Online is turned off, and I’m running Full SSL on the Cloudflare side.

I’ve looked through the Cloudflare troubleshooting guide for 520 errors, but that does not help. How can I see the exact error that Cloudflare is seeing from the web server to generate the 520 error?

1 Like

See my previous reply → Sometimes a CF 520 error - #52 by sandro


I tried, and changing the SSL to Full Strict does not change the Cloudflare 520 errors.

1 Like

@sandro, this thread is not about security, it’s about people getting random 520 errors regardless of their security settings.

You can’t see it on your side because your server never even receives the request from Cloudflare. At least that’s the case with me. And as far as I can see nobody in this thread explicitly confirmed they were seeing those requests in their logs, everybody just says they see “no errors”.
@1blas posted some errors from cloudflare logs a bit earlier: Sometimes a CF 520 error - #43 by blas

1 Like

For starters, 520s can still be because of broken security and, furthermore, I did not say it was about the 520s but pointed out that most people in this thread have no security in the first place.


Has anyone in this thread opened a ticket with CF tech support? What do they say?
I found at least six other threads here with similar symptoms started within last couple of weeks, most getting canned knee-jerk responses along the lines of “you all must be doing something wrong”, which seems to be a standard in this community…

1 Like

I use three servers with these specifications, 2x VPN and 1x physical server. Doesn’t matter how much traffic / load. Random 520.

Websites use WordPress 5.8 and WP Rocket cache + CDN.
I tested combination with and without WP rocket / CDN. Still get 520 errors.

Apache 2.4.48
DirectAdmin 1.62.4
Exim 4.91
MariaDB 10.4.20
Named 9.9.4
Php 7.4.22

1 Like

I tried again, but get no more 520 errors. Is it fixed?

1 Like

Nope, not for me - still getting random 520s…

1 Like