Just recently, the server this website was hosted on went down for several hours on account of some DDOS attacks. My host was considerate enough to offer a temporary migration to a different server as they sorted out the issue. I took up the offer and less than an hour later my site was back online again after I updated my DNS settings on Cloudflare.
While testing out the new server I noticed the WordPress Admin was loading much slowly compared to the previous server. To complicate matters, the customizer was only loading in HTML with no CSS stylings. When I looked in the browser console I noticed two critical scripts were not being loaded and instead all had the error code 524.
I immediately suspected my caching plugin was to blame and thus proceeded to purge all my cache. However, this didn’t solve the issue after which I responded by emptying the entire cache and deactivating the plugin but still the issue persisted.
I even went as far as to disable my firewall and use a different browser suspecting the browser cache was the culprit but still came up empty on both accounts. It was only after I tried an internet connection from a different ISP that the customizer finally loaded for the first time. But this did not last long as I ran into the same problem few moments later when I reloaded the page.
As time went by, the situation only got worse as the site would intermittently time out both on the back and frontend and end up on the Cloudflare’s A time out occurred error page with the code 524.
Error 524 caused by Cloudflare
Having ran out of options, I did a quick search online for the peculiar error code and it became clear that it was entirely associated with Cloudflare.
Realizing that, I wasted no time purging its cache and tried again but unfortunately that didn’t resolve the issue. So I decided to activate the Development Mode to bypass the cache but that didn’t help either.
Next on the table was to pause Cloudflare on the site. This would have all traffic go through my server instead of through Cloudflare first. After doing that, the error surprisingly went away.
There were no more intermittent 524 error codes but one of the side-effects of doing this was that the site was now insecure because it had been using the Cloudflare’s SSL Certificate. Actually, the browsers didn’t even bother loading the site since it was actually a BAD CERTIFICATE error.
I was to blame here though since I didn’t remember to install a new Let’s Encrypt SSL Certificate after the migration. So with Cloudflare paused, my site was using the server’s SSL Certificate which of course didn’t match with my domain hence the error. I however quickly resolved this by installing a new certificate in my panel.
Railgun: The Missing Link
The site was up and working now but it seemed it had go without the benefits of Cloudflare since unpausing only brought up back the error again.
I really wanted the site back up on Cloudflare so I went back online to look for a solution. At least this time round I knew what to search for as I had no doubt Cloudflare was causing the error. And true to that, I found a lot of similar victims most prominently on the Cloudflare community pages. Unfortunately, most of them had been closed unresolved.
My lucky break however came when I stumbled on this community tip: Community Tip – Fixing Error 524: A timeout occurred. Out of the 6 quick fix ideas listed there only one stood out – the sixth.
You see, my original server supported Railgun and as a result I had innocently activated it inside Cloudflare’s Speed settings. The new server the site was on however didn’t support the feature yet that option was still activated. To cut the long story short, disabling Railgun resolved the issue and the site is now back on Cloudflare.
Basically that’s all I had to and yet I had ended burning the whole day treating its symptoms. Nevertheless, the bright side is that now I’m better prepared for site migrations for domains on Cloudflare.