Suddenly tons of CF 520 errors

Silmarillion

Active member
Hello everybody,

since yesterday afternoon there are 520 error messages from Cloudflare in our forum. The error occurs completely randomly and everywhere. We only moved to a new server a few weeks ago and everything went perfectly. I will of course also contact my hoster. But I have already researched and noticed that this error can often not be localized and corrected immediately and clearly. That is why I also include you and XF in this problem, in the hope that bright people will be found here who might be able to contribute to a solution.

Error messages / problems:

cf520.png

error.png

doubleh.png

I made the following changes in .htaccess almost ten days ago:

Code:
<IfModule mod_deflate.c>
   AddOutputFilterByType DEFLATE text/plain
   AddOutputFilterByType DEFLATE text/html
   AddOutputFilterByType DEFLATE text/xml
   AddOutputFilterByType DEFLATE text/shtml
   AddOutputFilterByType DEFLATE text/css
   AddOutputFilterByType DEFLATE application/xml
   AddOutputFilterByType DEFLATE application/xhtml+xml
   AddOutputFilterByType DEFLATE application/rss+xml
   AddOutputFilterByType DEFLATE application/javascript
   AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

<ifModule mod_expires.c>
   ExpiresActive On
   # Add default Expires header
   <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg|woff|woff2)$">
   ExpiresDefault "access plus 1 year"
   </FilesMatch>
</ifModule>

Furthermore, I activated OPCache with php.ini, also around ten days ago.

A week ago I did "Rebuild Threads" and "Rebuild Cache" in order to be able to use an addon from @Xon ("Who Replied") correctly. During Rebuild Cache (over 3 million posts), only a blank page appeared in the ACP after around 2.5 million posts. After a refresh, however, it continued and the process was successfully completed. I will just mention this once, as there could possibly be a connection here.

Other addons that I use:

  • SC Separate Sticky Threads 2.0.0
  • TH Ignore More
  • Standard Library 1.6.0
  • User Activity 2.8.2
  • Xenforo Redirects for vBulletin 1.1.7
  • a not yet published addon by @Kirby which is still in the BETA.

Finally, there may be the option of a DDOS attack. Maybe it's just a coincidence, but two days ago we temporarily banned a member. At least I couldn't completely rule out a connection to the current problems.

I look forward to every well-intentioned suggestion. Thank you in advance.
 
Last edited:
It's nothing unusual with CF.
It's been happening on this site for a week or more.

 
Hello everybody,

since yesterday afternoon there are 520 error messages from Cloudflare in our forum. The error occurs completely randomly and everywhere. We only moved to a new server a few weeks ago and everything went perfectly. I will of course also contact my hoster. But I have already researched and noticed that this error can often not be localized and corrected immediately and clearly. That is why I also include you and XF in this problem, in the hope that bright people will be found here who might be able to contribute to a solution.

Error messages / problems:

View attachment 250452

View attachment 250453

View attachment 250454

I made the following changes in .htaccess almost ten days ago:

Code:
<IfModule mod_deflate.c>
   AddOutputFilterByType DEFLATE text/plain
   AddOutputFilterByType DEFLATE text/html
   AddOutputFilterByType DEFLATE text/xml
   AddOutputFilterByType DEFLATE text/shtml
   AddOutputFilterByType DEFLATE text/css
   AddOutputFilterByType DEFLATE application/xml
   AddOutputFilterByType DEFLATE application/xhtml+xml
   AddOutputFilterByType DEFLATE application/rss+xml
   AddOutputFilterByType DEFLATE application/javascript
   AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

<ifModule mod_expires.c>
   ExpiresActive On
   # Add default Expires header
   <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|svg|woff|woff2)$">
   ExpiresDefault "access plus 1 year"
   </FilesMatch>
</ifModule>

Furthermore, I activated OPCache with php.ini, also around ten days ago.

A week ago I did "Rebuild Threads" and "Rebuild Cache" in order to be able to use an addon from @Xon ("Who Replied") correctly. During Rebuild Cache (over 3 million posts), only a blank page appeared in the ACP after around 2.5 million posts. After a refresh, however, it continued and the process was successfully completed. I will just mention this once, as there could possibly be a connection here.

Other addons that I use:

  • SC Separate Sticky Threads 2.0.0
  • TH Ignore More
  • Standard Library 1.6.0
  • User Activity 2.8.2
  • Xenforo Redirects for vBulletin 1.1.7
  • a not yet published addon by @Kirby which is still in the BETA.

Finally, there may be the option of a DDOS attack. Maybe it's just a coincidence, but two days ago we temporarily banned a member. At least I couldn't completely rule out a connection to the current problems.

I look forward to every well-intentioned suggestion. Thank you in advance.

Hello @Silmarillion

I'm sorry to respond to a thread that's from April 2021, but I'm hopeful you wouldn't mind kindly sharing if you found a resolution to this?

I'm having the same issue. I've had a XF forum since 2010 and never been so stumped with an issue.

Constant Cloudflare 520s that are a nightmare to shake off - sometimes a full device clear can resolve it for a short spell but then it comes back;

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Our dedicated server/host can't see anything in the server logs. Nimbus are a very good host who I've been with for 10+ years so I've no reason to doubt them.

Cloudflare support have ignored the ticket for 4 weeks.

I've had to disable Cloudflare.

At a total loss, if anyone can recommend what could be causing the issue, or perhaps recommend someone who could offer paid support I'd be very grateful.
 
We had similar random Cloudflare 520 errors that Ken from Driven and I probably put 100 hours into solving. We tried about a dozen optimizations with no change in the frequency of the 520s.

When we turned off Cloudflare "Speed=>Optimization=>HTTP/2 to Origin", the 520 errors completely went away and we haven't seen a single 520 since. Turning off HTTP/2 is the money-ball.
 
Last edited:
All the websites I managed use the CloudFlare to Origin (HTTP2) option, but no problem at all; maybe your backend implementation of HTTP2 is somewhat broken?
I guess it's based on LiteSpeed or OpenLitespeed (they seem to produce very edgy, unstable versions of HTTP2 and Quic)?

Mine are all based on Nginx.
 
All the websites I managed use the CloudFlare to Origin (HTTP2) option, but no problem at all; maybe your backend implementation of HTTP2 is somewhat broken?
I guess it's based on LiteSpeed or OpenLitespeed (they seem to produce very edgy, unstable versions of HTTP2 and Quic)?

Mine are all based on Nginx.
Our backend is Apache-2.4.57 on AlmaLinux-8.8
 
We had similar random Cloudflare 520 errors that Ken from Driven and I probably put 100 hours into solving. We tried about a dozen optimizations with no change in the frequency of the 520s.

When we turned off Cloudflare "Speed=>Optimization=>HTTP/2 to Origin", the 520 errors completely went away and we haven't seen a single 520 since. Turning off HTTP/2 is the money-ball.

Thank you very much for this - hugely appreciated.

I'd deleted the the zone from Cloudflare and re-added it so Cloudflare generated us a new set of Nameservers as well as a clean set of settings across the board. In addition to that, I applied your fix and we've not had any 520s at all yet which is such a relief. Thanks a bunch.
 
Top Bottom