The Cloudflare 520 Mystery: How a Threat Intel Feed Took Down One Customer Through One Specific PoP

CloudFlare Logo

The Setup

A client running an OpenCart store and a WordPress site reported intermittent Cloudflare 520 errors. Initial reports mentioned issues with custom security software they were running (a proof-of-work challenge being injected via auto_prepend_file), which we helped them disable. The 520s continued.

The Pattern That Made No Sense

Over the following days, the client did remarkably thorough testing on their end and identified a pattern none of us could explain:

  • 520 errors only occurred when traffic routed through Cloudflare’s LAX (Los Angeles) PoP
  • Other Cloudflare PoPs worked perfectly
  • DNS-only mode (no proxy) worked perfectly
  • Direct origin access via hosts file worked perfectly
  • A clone of the site on a different host, behind the same Cloudflare configuration, worked perfectly

By every measure available to them, the issue was specific to the combination of their site + Cloudflare LAX + our infrastructure.

Continue reading “The Cloudflare 520 Mystery: How a Threat Intel Feed Took Down One Customer Through One Specific PoP”

Understanding TTFB: Why Lower TTFB Isn’t Always Better

TTFB: 62ms

Time to First Byte (TTFB) is a metric used to measure the responsiveness of a web server. It is the time taken for the server to send the first byte of data to the client. While a lower TTFB is generally desirable, it’s not always the best indicator of overall website performance. In this blog post, we will explore the relationship between TTFB and PHP output buffering, and discuss how optimizing for a low TTFB can sometimes be misleading.

TTFB and PHP Output Buffering

TTFB can be influenced by various factors, such as network latency, server processing time, and PHP output buffering. PHP output buffering is a technique where the server buffers the output of a script before sending it to the client. This can help improve performance by allowing the server to send larger chunks of data at once, rather than sending small bits of data as they become available. Additionally, output buffering can be beneficial when running a site built with plugins from various developers, such as is common with WordPress. In these situations, different plugins may send headers at different times, and without output buffering, this can cause errors as the server is only allowed to return response headers once.

However, focusing on a low TTFB can lead to a false sense of optimization. For example, you can artificially deflate TTFB by sending a single byte of data immediately before doing any significant processing and flushing the output buffer. This will result in a lower TTFB, but the overall load time for the user remains the same. In other words, a low TTFB doesn’t always equate to a better user experience.

Continue reading “Understanding TTFB: Why Lower TTFB Isn’t Always Better”