520 errors reaching Cloudflare

I’m having intermittent but regular 520 errors, and I can’t find if the issue is on my end or CF’s.

Cloudflarestatus.com shows a few US connections re-routed, but none are near me geographically. I don’t know if that’s relevant, though.

My server load is < 1, and I don’t see anything that would be a problem. I restarted Apache and MySQL, then disabled the firewall to make sure that an important IP isn’t being blocked, but that didn’t help.

Using tracert from my PC to my site, though, has a few errors:

1 12 ms 18 ms 20 ms
2 2 ms 20 ms 19 ms
3 48 ms 26 ms 32 ms
4 29 ms 30 ms 26 ms
5 * * * Request timed out.
6 * 114 ms *
7 41 ms 57 ms 26 ms
8 * 28 ms *
9 28 ms 39 ms 29 ms
10 82 ms 79 ms 121 ms
11 117 ms 53 ms 49 ms
12 57 ms 47 ms 82 ms
13 * * 53 ms
14 * 53 ms *
15 68 ms 52 ms 80 ms
16 44 ms 49 ms 48 ms

Trace complete.

What else can I do to determine whether the problem is on my end?

A [520 error] (Troubleshooting Cloudflare 5XX errors · Cloudflare Support docs) happens when your origin returns a response that is unexpected.

There are two key instances where this can happen in my experience:

  1. Your web server or networking equipment (Firewall, Load Balancer) reset the TCP connection after it was established. Sometimes when a web server crashes it will reset the connection. Check your web server error log for the timescale that the error occurred in and look for any error messages.
  2. Your web server returned an invalid response that exceeded our limits. Often this can happen if your web server is returning too many/too large headers. This is often caused by runaway scripts that return too many cookies, for example. The Code Igniter PHP framework has some known bugs around this too.

Thanks for the reply!

This problem seemed to resolve itself after a few hours, so I never did find out the source of the problem. That’s always a concern, because if “nothing” caused it and “nothing” fixed it then it can happen again without warning.

And worse, I don’t think there’s any way for me to get a notification that it’s happening.

Those hours of down time made me lose about $50 in ad revenue. Plus ever how many of my users went to a competing site, which can result in a long term loss.

That makes it all kinda scary.

But anyway, thanks again for the help!

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