520 error happened randomly, around 10%-20% of the time

What is the name of the domain?

vividjav.com

What is the error number?

520

What is the error message?

Web server is returning an unknown error Error code 520

What is the issue you’re encountering

520 error happened randomly, around 10%-20% of the time

What steps have you taken to resolve the issue?

I followed all the debug process provided by KB, but no hope. I also tried to gen two HAR files. but don’t know where to upload.
I tried to reduce my app in to a simple script: Echo a random number, and Done. The 520 errors still happened 10%-20% of the time.
I also tried to create sub domain, for this simple script only, it still happened. Please go here: test.php?rand=6 it is happening for rand=6. If not, just change to a random number, put rand=7, rand=8, etc. Try at least 10 times.

What are the steps to reproduce the issue?

Go here: /test.php?rand=6 and you will see the error right away.
If not, change 6 to any random number, repeat at least 10 times.

Just by visiting your Website, I got 404 error returned.

Furthermore, it’s a cached 404 error as well:
cf-cache-status: HIT

Did you tried to Purge Everything at Cloudflare?

Regarding Browser Cache TTL, try setting it to “Respect Existing Headers”.

At first test, I got 520 returned, no need to re-test more:

Is your PHP running and your Web server configuration files correctly pointed to use PHP socket or process for your Website? :thinking:

Any other .php file to test such as basic echo "hello world!" does it work?

Thank you for very quick reply. That is the helloword, the code is simple: <? echo rand(1,10000); die(' Done'); ?>.

If you try test.php?rand=11, you will see it works. Now the error rate seems higher than 20%. rand=12: 520 error, rand=13, 14, 15->22 : ok. rand=23 : 520 error

Does any number work fine over HTTPS when Cloudflare is temporarly paused? :thinking:

  • Use the “Pause Cloudflare on Site” option from the Overview tab for your domain at dash.cloudflare.com .
  • The link is in the lower right corner of that page.

Yes, everything works fine 100% when I disabled the Cloudflare cache (which is alternative way for Pause Cloudflare on Site).

I have others domain on the same CF account. pointing to the same server. All of them are working just fine.

Thank you for feedback.

Is there some firewall running?

Are Cloudflare IP addresses allowed to connect to your origin host/server? :thinking:

I have other domains on the same CF accounts, which are pointing to the same server. They are all working just fine. Only this domain, and it happened randomly.

I did research, it is similar to this:
https://www.reddit.com/r/CloudFlare/comments/t5uooa/cloudflare_520_errors_anyone_seeing_the_same/

For anyone comes here from search engine or future:
This is CF’s mistake. I never got help from anyone. This is how I solved the problem:
I deleted the domain from my CF account. Then I added to another CF account. Voila.

Hope this helps you, saves you 1-2 days of re-reading tutorials everywhere.

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