In recent days, we are seeing a lot of Error 520 when we have the Cloudflare WordPress APO active. After conducting several tests to isolate the problem, we’ve observed that these errors disappear when the APO function is disabled.
Open to all suggestions.
There are two key instances where this can happen in my experience:
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.
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.