• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

502 and 520 Errors with CloudFlare

#1
I've tried searching for solutions but cannot find any. I was getting reports of repeated 502 and 520 errors from users and then I started experiencing the same.

CloudFlare support is relatively useless at this point. I was able to capture the HAR file when it happens (it's intermittent).

I'm told by CF that the errors occur due to large duplicated headers at the origin and/or as a result of your origin prematurely closing the connection to the CF edge, which they said are caused typically by webserver issues.

Here's the duplicative header information. I loads the cookie repeatedly (I truncated it because it was much longer):

Set-Cookie
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly
xf_user=836%2Cd47cc26a964b68fa232bcb0d7fa1662ce89c953b; expires=Thu, 13-Apr-2017 11:03:41 GMT; Max-Age
=2592000; path=/; secure; httponly

As for webserver issues, I've asked LiquidWeb to investigate and they are not getting any logs of the server refusing the connection.

I have CloudFlare set up with the WAF and it was working just fine until about a week ago before these suddenly started occuring.