Magento’s GraphQL traffic shares a single /graphql endpoint. That makes a simple “requests per URL” rule blunt: a catalogue query, account mutation and complex cart request can have very different cost.
A sensible starting point
- Run Cloudflare’s managed WAF rules and review Security Events before creating exceptions.
- Create a rate-limiting rule scoped to
http.request.uri.path eq "/graphql". Begin in logging or with a generous threshold derived from real peak traffic, then tighten it carefully. - Where the plan and storefront design permit it, count by a stable authenticated characteristic rather than IP alone. Mobile networks, offices and privacy relays can place many genuine customers behind one address.
- Alert on sudden changes in GraphQL request rate, response time, error rate and origin CPU. A valid-looking query can still be expensive.
- Keep the origin inaccessible to arbitrary direct traffic, otherwise an attacker can bypass Cloudflare entirely.
What not to do
Do not create a blanket WAF bypass for /graphql. If a managed rule produces a false positive, identify the precise rule and operation, then make the narrowest tested exception possible. Do not copy a universal threshold from another store: headless storefronts, crawlers and logged-in traffic have different request shapes.
Cloudflare documents operation-aware and complexity-based GraphQL controls on higher plans. These are useful, but Magento-side limits, current patches and efficient resolvers remain necessary; the edge cannot repair an expensive custom resolver.
Sources: Cloudflare GraphQL rate-limiting guidance; Cloudflare managed rules.