Skip to content

Build1 publisher3 min readPublished

A Cloudflare challenge can score as a performance regression in overnight Lighthouse runs

PageSpeed Insights needs the origin HTML before it can measure anything, and a scheduled run that gets a bot challenge instead still produces a number. Cloudflare's own documentation decides which allowlist can fix it.

The Engineer · Build desk

Illustration accompanying A Cloudflare challenge can score as a performance regression in overnight Lighthouse runs

What happened

  • A URL that completes in PageSpeed Insights from a laptop returns a Cloudflare challenge, a 403 or an empty error shell when the same URL is put on a schedule, called through the PSI API, or run headless.
  • When the fetch fails, Google's tooling surfaces messages such as ERRORED_DOCUMENT_REQUEST or a generic connection failure.
  • With Bot Fight Mode enabled, a Skip rule aimed at the Chrome-Lighthouse User-Agent does not unblock portfolio monitoring.
  • Some runs report success while the lab screenshot shows a Cloudflare interstitial or a stripped challenge document, and the scores come back absurdly bad or oddly empty.
  • Cloudflare's guidance sends teams that need exceptions to Super Bot Fight Mode, or to IP Access rules.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • cost The wasted effort lands on engineering, which investigates LCP subparts on a page the tool never received, while the account team is reassured by a green manual screenshot.
  • contradiction Field data can stay normal while the lab score collapses, because real users are still being served; a team that reports lab and field as one story loses the evidence pointing at the edge.
  • constraint The fix is a Cloudflare product decision, because the allowlist patterns circulating in blog posts do not reach every product that can interrupt a run.
  • exposure An allowlist broad enough to admit Lighthouse also admits anything else presenting the same signature, so the scope has to stay narrow enough to keep scrapers out.

Lighthouse cannot compute a lab metric without a full HTML document, and then a rendered page [6]. When the edge returns a challenge instead of that document, the number is not a Core Web Vitals measurement at all. According to the dev.to writeup, it records a security product refusing to serve HTML to automation [2].

What differs between the check that passes and the 3am run that fails is the request [9]. The page is the same. An interactive session may carry cookies from an earlier challenge, can run a JavaScript challenge, and often comes from a residential network with no association with bulk scraping [7]. Scheduled and API-driven runs arrive from data-centre ranges and send predictable automation User-Agents, including Chrome-Lighthouse strings. They hold no challenge cookie, and they cannot complete a managed challenge the way a person with a browser can [8].

What you can do next depends on which product did the blocking. Cloudflare documents that Bot Fight Mode challenges traffic matching known bot patterns. It cannot be bypassed or skipped with WAF custom rules or Page Rules, because it does not run on the Ruleset Engine [12]. Skip actions live in WAF custom rules, so the rule never runs. IP Access rules are evaluated against the connecting IP before Bot Fight Mode looks at the request [14]. That ordering is why they still work. Those rules need the addresses PageSpeed Insights fetches from, and the writeup does not list them [21].

Super Bot Fight Mode adds configurable actions and supports Skip actions in WAF custom rules. The writeup calls that the practical path for allowing verified bots or monitoring User-Agents while other automated traffic still gets challenged [15]. Enabling it does not settle the question. Misconfigured "Definitely automated" or "Likely automated" actions still catch Lighthouse and PageSpeed Insights traffic, because Cloudflare does not classify it as a verified bot [16]. Under Attack Mode raises friction for almost everyone, and the writeup cites community threads reporting PageSpeed Insights failing with ERRORED_DOCUMENT_REQUEST while that mode is on [17].

The writeup puts the cost of the wrong diagnosis at a sprint spent treating a blocked fetch as an LCP incident [18]. Matching the failed run to the right Cloudflare product, it says, saves a week of rewriting Largest Contentful Paint budgets on a document that never left the edge [19]. Those are one practitioner's figures, not a measurement, and they only transfer to a team that would have started in the front end. Check Cloudflare Security Events for that URL at the timestamp of the failed run, where Bot Fight Mode, Super Bot Fight Mode, a WAF custom rule, rate limiting or Under Attack Mode is labelled against the request [4].

What to watch

  • Whether Cloudflare classifies PageSpeed Insights fetchers as verified bots; that would end the dependence on User-Agent matching in Super Bot Fight Mode.
  • Whether Google publishes the IP ranges its PageSpeed Insights fetchers use, since IP Access rules need them.
  • Whether teams running Under Attack Mode see these failures clear when it is switched off; the current evidence is community threads.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories