AWS WAF CAPTCHA is a rule action in Amazon’s web application firewall that asks a client to prove it is a real browser, or a real person, before a request reaches the application. Site owners attach it to specific rules in a web ACL, so only traffic that matches those rules, such as a burst of requests from one IP range or repeated hits on a costly search endpoint, is asked to verify. Everything else passes through untouched.
The mechanics rest on two related actions and one token. The Challenge action runs a silent JavaScript check in the browser, with no puzzle shown, and is meant to filter out simple scripts. The CAPTCHA action goes further and shows a visual or audio puzzle. When either check passes, AWS WAF issues a token, stored in a cookie named aws-waf-token, and later requests carry it back. As long as that token stays valid, the client is not asked again.
That design has practical consequences for engineering teams. A QA engineer testing a staging site behind a web ACL, or a data team collecting publicly available pricing or catalogue pages under the site’s terms, will meet these checks in automated runs just as any crawler would. Some teams handle this by allowlisting test traffic at the firewall. Others, when they do not control the WAF configuration, use a recognition service such as CapMonster Cloud to return a solved puzzle so the run can continue. Either way, it helps to know exactly what the firewall is checking.
What Happens When a Request Hits a CAPTCHA Rule?
The request is either let through on a valid token or held back and answered with an interstitial page instead of the application’s response. AWS WAF first evaluates the web ACL rules in priority order. If a rule with a CAPTCHA action matches, the firewall looks for the aws-waf-token cookie on the request.
Without a valid token, the response depends on the action. For CAPTCHA, AWS WAF returns an HTTP 405 status with an HTML page that loads the puzzle. For Challenge, it returns HTTP 202 with a page that runs the JavaScript check quietly in the background. Both pages only make sense to a browser, which is why AWS recommends these actions for GET requests that expect HTML, not for API calls that expect JSON.
Once the client completes the puzzle or the silent check, the page sends the result to AWS WAF, which issues or refreshes the token and sends the browser back to the original URL. The repeated request now carries the cookie, matches the same rule, and this time is allowed through to the origin.
For single-page applications and mobile apps, the interstitial flow is awkward. AWS provides a JavaScript integration SDK and a CAPTCHA JavaScript API that let developers render the puzzle inside their own interface and fetch the token in the background, plus SDKs for Android and iOS. The token behaves the same way regardless of how it was obtained.
How Does AWS WAF Validate the Token?
AWS WAF validates the token by checking its integrity, its timestamps and its domain against the settings of the web ACL that evaluates the request. The token is encrypted and generated by AWS, so the client cannot read or edit it, and any tampering makes it invalid.
The token records when the client last solved a CAPTCHA and when it last passed a Challenge, as separate timestamps. Each web ACL, and optionally each rule, defines an immunity time: how long a solved check counts. The default is 300 seconds, and owners can set values from 60 seconds up to three days. When a request arrives, the firewall compares the relevant timestamp with the immunity time. If it is older, the token is treated as expired and the client sees the check again, even though the cookie still exists.
Domain scope matters too. By default, a token is accepted only for the domain that issued it. Owners who run several related sites can add a token domain list to the web ACL so one token works across them, for example a main site and its subdomains.
AWS WAF also adds labels to requests based on token state, such as absent, accepted or rejected, along with reasons like an expired or invalid token. Other rules can match on those labels, which lets owners rate-limit clients that keep failing checks, or simply log them for analysis, without blocking anyone outright.
For testing teams, a few habits follow from this. Keep cookies between requests in a test session so a valid token is reused rather than triggering repeated puzzles. Respect the immunity window instead of flooding endpoints that are clearly protected. Check the site’s terms and robots.txt before collecting any data, and stick to pages that are public. When results look inconsistent, the WAF logs and labels usually show whether a token was missing, expired or scoped to the wrong domain.
AWS WAF CAPTCHA is less a single puzzle than a token system with a puzzle at its entrance. Once you understand the Challenge and CAPTCHA actions, the 405 and 202 responses, immunity time and token domains, it becomes much easier to configure rules sensibly and to design automated tests that behave like well-mannered clients.



