Long TTFB with Cloudflare enabled

I’m running a website on Apache2/Ubuntu 20.04, and for some reason I’m getting a really long TTFB (~15 seconds), this only happens while I’m using Cloudflare’s Proxy/CDN. If I’m connecting directly to my server’s IP address (without Cloudflare’s Proxy/CDN) (inside & outside of my network), this long TTFB doesn’t happen.

In the image link above, you can see that Cloudflare returns a status “522”, which means that the connection timed out, and Cloudflare could not negotiate a TCP handshake with the origin server. But the website actually loads after these 15 seconds.

On the same system that I’m running Apache, I’m running a html control panel called “Webmin” (not hosted in Apache), to manage my server remotely, and I’m using it with Cloudflare’s Proxy as well, and the same thing happens with it, I get the same ~15 seconds for the TTFB. I think is worth noting as well that I have another server on the same network that is running Windows 10 with IIS as the hosting server, and I’m using Cloudflare’s Proxy/CDN, and I’ve never had any problems with it. With that, I think this might be some problem with Ubuntu, but I have no clue of what could it be.

Here’s what I’ve done already, but even after doing all of those things I’m still getting that long TTFB:

  • Specified the Cipher Suite in Apache’s configuration file.
  • I’ve added all of Cloudflare’s chained certificates (including Cloudflare’s Root CA).
  • Whitelisted all of Cloudflare’s IP ranges in Ubuntu’s firewall.
  • Specified TLS/SSL version in Apache’s configuration file.
  • Checked and reinstalled Cloudflare origin CA.

The Apache configuration file & other archives that might be useful are available here.

Any help is much appreciated!

Maybe Support can take a look at the connection to see what’s going on. They might ask for a HAR file to analyze, so I suggest you attach one to your request.

To contact Cloudflare Customer Support, login & go to https://dash.cloudflare.com/?account=support and select get more help. If you receive an automatic response that does not help you, please reply and indicate you need more help.

This topic was automatically closed after 30 days. New replies are no longer allowed.