I’ve been hemorrhaging hours of research to this and cannot seem to find the right solution, even to understand the problem itself.
The scenario:
I have an multiple ubuntu servers, each server runs an apache hosting multiple sites via apache-vhost. I have a CloudFlare free plan and configures it to only do Flexible SSL/TSL and a Page Rule to force HTTPS access.
The problem:
Some client gets Cloudflare 524 Error while some are just fine.
Tests/Observations:
-
If I disabled the Page Rule force HTTPS, everything is fine. So this should point on the https problem, but why does the https works on some, and not on the other clients?
-
http requests are properly logged in the access-log of each vhosted site, I tried it myself, it actually logged my request but I still get Error 524.
-
The servers are not overloaded but I still get Error 524.
-
Increased the mpm_prefork settings, still Error 524.
-
Disallowed any IPs except cloudflare ips via iptables, still Error 524
-
Disabled multiple vhosted site, still Error 524
I’m currently out of idea on how to understand this problem to solve it. I’ve been exhausing weeks of research but all threads mentioning this specific error doesn’t fit with my case. Help!
2
Answers
you said you enabled force HTTPS with cloudflare.
Do you even have an SSL certificate on your server? Without this, an https connection is not possible.
If that’s the case try to run the following commands:
sudo apt-get install certbot python-certbot-apache
certbot --apache -d example.com
This should automaticly generate a certificat for your domain.
Note: when you have subdomains, you have to issue a separate certificate for them!
524 Error means that cloudflare got a timeout from your server.
Try looking at your logs for long running pages that might be exceeding the cloudflare timeout threshold (probably 100 seconds).
What looks like a client problem is really just the nature of random timeouts impacting different clients differently.
http://windowsbulletin.com/how-to-fix-cloudflare-error-524-a-timeout-occurred/