We have a number of websites on the CloudFlare free plan. Today, we are experiencing a very peculiar issue with one of them that has been working flawlessly for months.
Every 1 in 10 requests, we get a CloudFlare 520 error page. There are no errors logged at our origin. Our origin is not under heavy load and there isn’t anything abnormal going on.
After making various changes on our origin (disabling firewalls, double checking IP addresses, etc) I have come to a very strange conclusion.
Our origin has 2 IP addresses. One we use for CF websites, the other we use for non-CF websites. I don’t want to reveal the IP’s, but let’s call them #IP-1 and #IP-2
When I change the proxied A-record in CF from #IP-1 to #IP-2 the issue goes away.
However, here’s the odd thing. We have various other wesites using #IP-1 which are not affected by this issue.
To prove the point I setup a test page which redirects back to itself every 2 seconds (including a random query string parameter to avoid any caching). I did it as follows:
www.website-1.com/test (using #IP-2) - no issues
dev.website-1.com/test (using the original #IP-1) - after about 10 requests I get a 520 error from CF
www.website-2.com/test (using the original #IP-1) - no issues
So the issue seems to be directly related to website-1.com and #IP-1, but I cannot fathom why this would be the case.