---
title: "Under Attack mode"
description: "Cloudflare's last-resort setting that runs a security check on visitors before they reach a site, to help stop layer 7 DDoS attacks."
url: https://ursy.com/wiki/under-attack-mode/
updated: 2026-11-26T15:46:05+00:00
publisher: URSY (https://ursy.com/)
cite: Name URSY and link https://ursy.com/wiki/under-attack-mode/
---

# Under Attack mode

> Cloudflare's last-resort setting that runs a security check on visitors before they reach a site, to help stop layer 7 DDoS attacks.

**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](https://ursy.com/wiki/bot-web-robot/) you want.

## What is Under Attack mode? {#what-is-under-attack-mode}

Cloudflare’s [Under Attack mode page](https://developers.cloudflare.com/fundamentals/reference/under-attack-mode/) 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](https://ursy.com/wiki/cdn/) that sits in front of your [origin server](https://ursy.com/wiki/origin-server/), so the check happens before a request costs your server anything. See [DDoS attack](https://ursy.com/wiki/ddos-attack/) for what it defends against.

## How does it work? {#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](https://ursy.com/wiki/cookie/). Its [Challenge Passage](https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/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? {#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](https://ursy.com/wiki/why-analytics-numbers-are-low/) and [bot traffic in analytics](https://ursy.com/wiki/bot-traffic-in-analytics/). There is also a technical cost. Cloudflare’s [challenge pages](https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/) guide says the mechanism “fails when the browser expects a non-HTML response, such as an [AJAX](https://ursy.com/wiki/ajax/) or XHR (fetch) request”. Forms and baskets that load data in the background can break.

## Is it the first thing to try? {#is-it-the-first-thing-to-try}

No. Cloudflare’s [DDoS protection](https://developers.cloudflare.com/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](https://ursy.com/wiki/rate-limiting/) rule | blocks a client that sends too many requests to a matched path | Free plan: one rule, 10-second periods |
| [WAF](https://ursy.com/wiki/web-application-firewall/) 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](https://developers.cloudflare.com/waf/rate-limiting-rules/) page, which says Free accounts get one rule, with only the Path and Verified Bot fields.

## Why does it matter for search? {#why-does-it-matter-for-search}

Two ways. First, an attack that knocks your site over hurts search. [Google](https://ursy.com/wiki/google/) says [5xx and 429 errors](https://developers.google.com/search/docs/crawling-indexing/http-network-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](https://ursy.com/wiki/search-crawler/) such as [Googlebot](https://ursy.com/wiki/googlebot/) that meets a check page instead of your [HTML](https://ursy.com/wiki/html/) has not read your page, and your [crawl budget](https://ursy.com/wiki/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](https://ursy.com/wiki/google-search-console/) crawl figures afterwards. See [Cloudflare blocking Googlebot](https://ursy.com/wiki/cloudflare-blocking-googlebot/).

## Why does it matter for AI answers? {#why-does-it-matter-for-ai-answers}

An [AI crawler](https://ursy.com/wiki/ai-crawler/) collects pages for training or an AI index. A [live fetcher](https://ursy.com/wiki/live-fetcher/), such as [ChatGPT-User](https://ursy.com/wiki/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](https://ursy.com/wiki/ai-agent/) trying to use your [MCP](https://ursy.com/wiki/mcp/) address or API gets HTML it cannot use. For the wider choices, see [block AI crawlers on Cloudflare](https://ursy.com/wiki/block-ai-crawlers-on-cloudflare/).

## How can a script tell it was challenged? {#how-can-a-script-tell-it-was-challenged}

Cloudflare’s [detect a challenge response](https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/detect-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-worked-example}

A law firm’s enquiry form is [hit](https://ursy.com/wiki/hit-analytics/) 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](https://ursy.com/wiki/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 {#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](https://ursy.com/wiki/cloudflare-bot-fight-mode/) and [Super Bot Fight Mode](https://ursy.com/wiki/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](https://ursy.com/wiki/user-agent/). See [verified bots](https://ursy.com/wiki/verified-bots/).

## How to check it {#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](https://ursy.com/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](https://ursy.com/wiki/http-status-code/).
3. Run the [JavaScript SEO Checker](https://ursy.com/javascript-seo-checker/) to see what a visitor that does not run JavaScript receives. See [JavaScript SEO](https://ursy.com/wiki/javascript-seo/).
4. Check the files machines need: the [XML Sitemap Checker](https://ursy.com/sitemap-checker/), the [llms.txt Checker](https://ursy.com/llms-txt-checker/) and [AI Agent Readiness](https://ursy.com/agent-readiness-checker/) for your well-known files and MCP. If they get a challenge, bots do too.
5. Run [Can Google index this page?](https://ursy.com/indexability-checker/) on your key pages once the mode is off.
6. Use the [Edge Cache Checker](https://ursy.com/cache-checker/) to see whether pages come from the [edge cache](https://ursy.com/wiki/edge-cache/); cached pages cost the origin nothing.
7. Run the [Cookie Checker](https://ursy.com/cookie-checker/) to see which cookies, such as `cf_clearance`, a page sets. See [cookie banner](https://ursy.com/wiki/cookie-banner/).
8. After the attack, drop your [server logs](https://ursy.com/wiki/server-logs/) into the [AI Crawler Log Analyser](https://ursy.com/ai-crawler-log-analyzer/) to see which bots were turned away, and check any “Googlebot” or “[GPTBot](https://ursy.com/wiki/gptbot/)” with [Verify an AI Bot](https://ursy.com/verify-ai-bot/). See [log file analysis](https://ursy.com/wiki/log-file-analysis/).
9. If the attack hit a WordPress login or `xmlrpc.php`, run the [WordPress Security Checker](https://ursy.com/wordpress-security-checker/) and the [Security Headers Checker](https://ursy.com/security-headers-checker/).
10. Confirm the site answers again with the [website down checker](https://ursy.com/webmaster-tools/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](https://ursy.com/pro/scraper-and-flood-detector/), [bot cost](https://ursy.com/pro/bot-cost/) and the [fake bot detector](https://ursy.com/pro/fake-bot-detector/).

## What URSY.com counts {#what-ursy-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](https://ursy.com/methodology/) and the [bots directory](https://ursy.com/bots/).

## Questions {#questions}

### Does it replace Cloudflare’s DDoS protection? {#does-it-replace-cloudflares-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? {#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? {#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? {#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.

## Related words {#related-words}

- [DDoS attack](https://ursy.com/wiki/ddos-attack/)
- [Managed challenge](https://ursy.com/wiki/managed-challenge/)
- [Cloudflare Bot Fight Mode: what it really blocks](https://ursy.com/wiki/cloudflare-bot-fight-mode/)
- [Super Bot Fight Mode](https://ursy.com/wiki/super-bot-fight-mode/)
- [Rate limiting](https://ursy.com/wiki/rate-limiting/)
- [Web application firewall](https://ursy.com/wiki/web-application-firewall/)
- [Cloudflare Turnstile](https://ursy.com/wiki/cloudflare-turnstile/)
- [CAPTCHA](https://ursy.com/wiki/captcha/)
- [CDN](https://ursy.com/wiki/cdn/)

## Sources {#sources}

- [Cloudflare Docs: Under Attack mode](https://developers.cloudflare.com/fundamentals/reference/under-attack-mode/), checked 24 November 2026
- [Cloudflare Docs: Interstitial Challenge Pages](https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/), checked 24 November 2026
- [Cloudflare Docs: Challenge Passage](https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/challenge-passage/), checked 24 November 2026
- [Cloudflare Docs: Detect a Challenge Page response](https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/detect-response/), checked 24 November 2026
- [Cloudflare Docs: DDoS Protection](https://developers.cloudflare.com/ddos-protection/), checked 24 November 2026
- [Cloudflare Docs: Rate limiting rules](https://developers.cloudflare.com/waf/rate-limiting-rules/), checked 24 November 2026
- [Google Search Central: How HTTP status codes and network errors affect Google Search](https://developers.google.com/search/docs/crawling-indexing/http-network-errors), checked 24 November 2026

*Updated 24 November 2026 by URSY.com.*
