Skip to the content
Start free

Under Attack mode

Under Attack mode is a Cloudflare setting that runs extra security checks on visitors before they reach a website, to help stop layer 7 (application) DDoS attacks. Cloudflare calls it one of the last resorts when a site is under attack. It can keep a site standing, but every visitor meets a check page first, including some of the bots you want.

What is Under Attack mode? #

Cloudflare’s Under Attack mode page says it “performs additional security checks to help mitigate layer 7 DDoS attacks”. Visitors see an interstitial page. People who pass reach the site; suspicious traffic is blocked. Cloudflare is a CDN that sits in front of your origin server, so the check happens before a request costs your server anything. See DDoS attack for what it defends against.

How does it work? #

The check runs in the visitor’s browser. Cloudflare says Under Attack mode “requires your browser to support JavaScript to display and pass the interstitial page”, and that the check “determines whether to block or allow a visitor within five seconds”. It is “turned off by default for your zone”. You switch it on for an attack, then off again.

After a visitor passes a challenge, Cloudflare sets a cf_clearance cookie. Its Challenge Passage page says the cookie has “a lifetime of 30 minutes” by default, and suggests a value “between 15 and 45 minutes”. Until it runs out, the visitor is not checked again.

What does it cost you? #

Cloudflare is plain about the price. Under Attack mode “will temporarily pause access to your site and impact your site analytics”. Third-party analytics tools may be affected too. Expect lower figures and gaps while it is on. See why analytics numbers are low and bot traffic in analytics. There is also a technical cost. Cloudflare’s challenge pages guide says the mechanism “fails when the browser expects a non-HTML response, such as an AJAX or XHR (fetch) request”. Forms and baskets that load data in the background can break.

Is it the first thing to try? #

No. Cloudflare’s DDoS protection page says it “automatically detects and mitigates” DDoS attacks, on all plans, across layers 3/4 and layer 7. Narrower tools come next:

Tool What it does Reach
Automatic DDoS protection Cloudflare’s own systems detect and mitigate always on, all plans
Rate limiting rule blocks a client that sends too many requests to a matched path Free plan: one rule, 10-second periods
WAF custom rule challenges or blocks requests that match an expression one path, one country, one pattern
Under Attack mode on one path the interstitial check for that path only a Configuration Rule
Under Attack mode for the whole site every visitor is checked the last resort

The rate limiting facts come from Cloudflare’s rate limiting rules page, which says Free accounts get one rule, with only the Path and Verified Bot fields.

Two ways. First, an attack that knocks your site over hurts search. Google says 5xx and 429 errors make its crawlers slow down, and that URLs which persistently return a server error are removed from the index. Second, the cure can hurt too. Cloudflare’s Under Attack page gives no guidance on search crawlers. A search crawler such as Googlebot that meets a check page instead of your HTML has not read your page, and your crawl budget is spent on nothing. Google also says it does not index URLs that return a 4xx code. Keep the mode short and narrow, and watch Google Search Console crawl figures afterwards. See Cloudflare blocking Googlebot.

Why does it matter for AI answers? #

An AI crawler collects pages for training or an AI index. A live fetcher, such as ChatGPT-User, fetches a page because a person just asked about it. Both are automated. Any visitor that cannot run JavaScript cannot pass this check. If one of them gets the check page, the person gets an answer without you, or an answer built from an older copy. An AI agent trying to use your MCP address or API gets HTML it cannot use. For the wider choices, see block AI crawlers on Cloudflare.

How can a script tell it was challenged? #

Cloudflare’s detect a challenge response page says the response carries the header cf-mitigated, “present and set to challenge“, for every challenge type. Challenge responses have a text/html content type, whatever was requested. So a feed, a JSON file or an image that comes back as HTML with that header has been challenged.

A worked example #

A law firm’s enquiry form is hit by a flood of fake submissions on a Friday evening, and the whole site slows down. Turning on Under Attack mode for every page would make each client wait for a check and pause analytics across the site. A narrower move is a Configuration Rule for the attacked path only. Cloudflare’s own example uses /admin:

(starts_with(http.request.uri.path, "/admin"))

The firm writes the same rule for /contact, sets the security level to “I’m Under Attack”, and the rest of the site carries on as normal. A Cloudflare Turnstile widget on the form would have been a gentler first step. On Monday, with the flood over, the rule is switched off. The firm checks the form from a normal browser and checks that its sitemap and feed fetch without the cf-mitigated header.

Common mistakes #

  • Leaving it on. Every visitor keeps meeting the check, and your analytics stay affected long after the attack ends.
  • Using it first. Cloudflare describes it as a last resort; a rate limiting or WAF rule on the attacked path may be enough.
  • Forgetting non-browser visitors. Scripts, feed readers, monitoring tools and many bots get the check page instead of your content.
  • Breaking background requests. AJAX and fetch calls expect data, not a challenge page.
  • Mixing it up with bot settings. Bot Fight Mode and Super Bot Fight Mode are always-on bot tools; Under Attack mode is an emergency switch.
  • Trusting a bot’s name. Anyone can send a well-known bot name. Check the address, not the user agent. See verified bots.

How to check it #

  1. In the Cloudflare dashboard, open the site’s overview and look at Under Attack Mode under Quick Actions. Check Configuration Rules too: the setting can be on for selected paths only, such as /admin. Check IP Access Rules, which can apply it to a country, network (ASN) or IP range. To see what visitors see, Cloudflare says to open Custom Pages and view the default for Managed Challenge / I’m Under Attack Mode.
  2. Run the HTTP Header Checker on your home page. Look for cf-mitigated: challenge, a text/html content type where you expect something else, and the HTTP status code.
  3. Run the JavaScript SEO Checker to see what a visitor that does not run JavaScript receives. See JavaScript SEO.
  4. Check the files machines need: the XML Sitemap Checker, the llms.txt Checker and AI Agent Readiness for your well-known files and MCP. If they get a challenge, bots do too.
  5. Run Can Google index this page? on your key pages once the mode is off.
  6. Use the Edge Cache Checker to see whether pages come from the edge cache; cached pages cost the origin nothing.
  7. Run the Cookie Checker to see which cookies, such as cf_clearance, a page sets. See cookie banner.
  8. After the attack, drop your server logs into the AI Crawler Log Analyser to see which bots were turned away, and check any “Googlebot” or “GPTBot” with Verify an AI Bot. See log file analysis.
  9. If the attack hit a WordPress login or xmlrpc.php, run the WordPress Security Checker and the Security Headers Checker.
  10. Confirm the site answers again with the website down checker.

Single checks on each tool page: free, no account (2 a day). The full audit: a free account (sign in with an emailed code), 1 a day. In URSY Pro, opening in stages: the scraper and flood detector, bot cost and the fake bot detector.

What URSY.com counts #

We read the CDN’s edge log, which lists every request it answered, cached or not, with its status code and a request ID. A request seen in both the edge log and the origin is counted once. Requests for secrets such as .env or wp-config, xmlrpc and scanner paths are counted as attacks, whatever name they send, and never as people. Bot names are checked against 18 official IP lists. See our methodology and the bots directory.

Questions #

Does it replace Cloudflare’s DDoS protection? #

No. Cloudflare says its automatic DDoS protection is on all plans. Under Attack mode adds a check page on top, for when that is not enough.

How long does the check take? #

Cloudflare says it decides within five seconds. A visitor who passes is not checked again until Challenge Passage runs out, 30 minutes by default.

Will it stop Google crawling my site? #

Cloudflare’s page does not say. Keep it short and narrow, test with a tool, and watch Search Console afterwards.

Can I use it on one page only? #

Yes. A Configuration Rule can apply it to a path, and IP Access Rules to a country, ASN or IP range.

Sources #

Updated 24 November 2026 by URSY.com.

Cite this page: Under Attack mode. URSY. Updated 26 November 2026. https://ursy.com/wiki/under-attack-mode/ · Section links

Tools for this

All 871 wiki entries, A to Z →