Cloudflare CAPTCHA on at least one ampersand

Simon Willison's Blog Tools

Summary

Simon Willison shares a trick to configure Cloudflare's Managed Challenge to only trigger for search URLs containing an ampersand, improving usability for simple queries.

No content available
Original Article
View Cached Full Text

Cached at: 06/16/26, 01:01 AM

# TIL: Cloudflare CAPTCHA on at least one ampersand Source: [https://simonwillison.net/2026/Jun/16/captcha-on-at-least-one-ampersand/](https://simonwillison.net/2026/Jun/16/captcha-on-at-least-one-ampersand/) [TIL](https://simonwillison.net/elsewhere/til/)[Cloudflare CAPTCHA on at least one ampersand](https://til.simonwillison.net/cloudflare/captcha-on-at-least-one-ampersand)— I use Cloudflare's CAPTCHA \(they call it a "Managed Challenge"\) on \[simonwillison\.net/search/\]\(https://simonwillison\.net/search/\) to prevent crawlers from following every single possible combination of my \[faceted search\]\(https://simonwillison\.net/2017/Oct/5/django\-postgresql\-faceted\-search/\) UI\. I'm using Cloudflare's CAPTCHA \(they call it a "Web Application Firewall \> Custom rules \> Managed Challenge" these days\) to prevent crawlers from aggresively spidering my[faceted search engine](https://simonwillison.net/2017/Oct/5/django-postgresql-faceted-search/)on this site, but I got fed up of even simple`?q=term`searches triggering the challenge\. After some mucking around with Claude Code it turns out you can register the following rule instead, so the CAPTCHA only kicks in for search URLs containing at least one ampersand: `\(http\.request\.uri\.path wildcard r"/search/\*" and http\.request\.uri\.query contains "&"\)` And now[/search/?q=lemur](https://simonwillison.net/search/?q=lemur)works without triggering a CAPTCHA\! Also included: notes on[trying out the Cloudflare MCP with Claude Code](https://til.simonwillison.net/cloudflare/captcha-on-at-least-one-ampersand#trying-the-cloudflare-mcp), though it turned out not to be able to edit the rules in question so I had Claude Code[switch to the Cloudflare API](https://til.simonwillison.net/cloudflare/captcha-on-at-least-one-ampersand#using-the-api-instead)instead\.

Similar Articles

CAPTCHAs have failed for 20 years

Hacker News Top

A deep dive into the 20-year arms race between CAPTCHAs and automated solvers, culminating in Browserbase's new approach of agent identity to bypass CAPTCHAs entirely by verifying browser identity.

I Will Not Add Query Strings to Your URLs

Lobsters Hottest

Susam Pal discusses the practice of avoiding query strings in URLs, referencing Chris Morgan's advocacy for clean URLs and the technical implications for web development and SEO.

Prove you are a robot: CAPTCHAs for agents

Hacker News Top

Browser Use launched agent-native signup using reverse-CAPTCHAs that are designed to keep humans out and let AI agents in. Agents solve obfuscated math problems to gain API key access and free tier benefits.

CSP Allow-list Experiment

Simon Willison's Blog

A web tool experiment demonstrating how to handle Content Security Policy errors in sandboxed iframes by intercepting fetch requests and prompting users to whitelist domains. The tool was built using GPT-5.5 via the Codex desktop app.