Skip to content
Security

How to block PetalBot with Cloudflare

Stop PetalBot from loading your WordPress site with a Cloudflare custom rule, a robots.txt line or a rate limit, and how to check the rule works.

By WP24×7 engineers4 min readPublished December 9, 2022Updated November 29, 2026

At a glance

PetalBot is the crawler behind Petal Search, and on a small WordPress server a heavy crawl can look like a traffic spike. To block it, create a Cloudflare custom rule where the user agent contains PetalBot and set the action to Block, or add a Disallow line to robots.txt first. A rate limit is a gentler option. Test with curl and check Security Events.

Updated November 29, 2026 · For WordPress site owners and admins using Cloudflare

  • For owners whose server is slowed by PetalBot crawling
  • Options robots.txt, Cloudflare custom rule, rate limiting
  • Rule (http.user_agent contains "PetalBot") or (http.user_agent contains "PetalSearch")
  • Effect on Google none; Google uses Googlebot
  • Safety note current rules first; start with Managed Challenge if cautious
  • Test curl with a spoofed user agent should return 403
  • Help speed optimization and WordPress support

PetalBot is the crawler behind Petal Search. On a small WordPress server, a heavy crawl can look like a traffic spike. To block it, create a Cloudflare custom rule where the user agent contains "PetalBot" and set the action to Block. If you would rather ask nicely first, add a Disallow line to robots.txt.

How do I know PetalBot is the problem?

Do not block on a hunch. Check first:

  • Look at raw access logs (your host's panel, or /var/log/nginx/access.log on a VPS) and search for PetalBot. A few hundred requests a day is normal; tens of thousands from one crawler is worth acting on.
  • In Cloudflare, open Analytics & Logs and filter by user agent if your plan shows it.
  • Check whether load lines up with PHP workers at their limit or high CPU. Crawlers requesting many uncached URLs, such as search results and filters, cost far more than ones fetching static pages.

Which option should I choose?

OptionStrengthLimit
robots.txtGentle, honest crawlers obey itNot instant; bad bots ignore it
Cloudflare custom ruleStops requests at the edgeA wrong expression can block real visitors
Rate limitingLets Petal Search index you without hammeringNeeds tuning
Stopping a crawler at the edge, before it reaches the server

How do I apply each option?

Cloudflare's WAF custom rules replaced the older Firewall Rules screen.

  1. Log in to Cloudflare and choose your domain.
  2. Go to Security, WAF, Custom rules and click Create rule.
  3. Name it, for example Block PetalBot.
  4. Under When incoming requests match, click Edit expression and paste:
(http.user_agent contains "PetalBot") or (http.user_agent contains "PetalSearch")
  1. Set Then take action to Block and deploy.

Matching on contains is case-sensitive in Cloudflare expressions, so use lower(http.user_agent) contains "petalbot" to catch variations. For caution, set the action to Managed Challenge first.

How do I check the rule works?

Use your own terminal and fake the user agent:

curl -I -A "Mozilla/5.0 (compatible; PetalBot;+https://webmaster.petalsearch.com/site/petalbot)" https://example.com/

Replace example.com with your domain. A blocked request returns 403 with a Cloudflare error page, and a normal request should still return 200. Then watch Security, Events in Cloudflare, which lists each blocked request with the rule that matched.

What can go wrong?

ProblemWhyFix
Blocking too broadlyA short string like bot catches Googlebot and BingbotMatch PetalBot only
Rule orderAn earlier "allow" rule stops yours runningMove the block above it
Origin still exposedBots reaching your server IP skip CloudflareRestrict the origin to Cloudflare's published ranges
Spoofed agentsA user-agent string is just textTreat the rule as a filter for honest crawlers, not security

When should I leave PetalBot alone?

If you sell to people who use Huawei devices or Petal Search, a crawl is how you appear there, so slow it down rather than banning it. Keep a short record of what you decided and why, and review custom rules every few months: Security Events shows how often each rule fires, and a rule that has not matched for months can go.

What else reduces crawler load?

Bots do the most damage on pages WordPress must build from scratch every time. Page caching, a CDN rule that caches static files and blocking internal search results from crawling remove most of the cost, whoever is crawling. For a server that buckles under routine crawler traffic, see WordPress speed optimization or an ongoing WordPress support plan. For other protections, read our guide to Cloudflare rules that secure WordPress.

Spike taking your site down?

An engineer can read the logs with you.

FAQ

Questions people ask

12 answers. Can't find yours? Ask an engineer.

Is PetalBot a malicious bot?

No. It is the crawler of Huawei's Petal Search, a real search engine. It becomes a problem only when it sends enough requests to slow a small server, which is why many site owners limit or block it.

Link to this answer
Will blocking PetalBot hurt my Google rankings?

No. Google uses Googlebot, not PetalBot. You lose only visibility in Petal Search, which matters mostly if your audience uses Huawei devices.

Link to this answer
Can a bot ignore the block by faking its user agent?

Yes. A user-agent rule stops honest crawlers. Aggressive scrapers can claim to be a browser, so pair the rule with rate limiting or Cloudflare's bot controls if you see abuse.

Link to this answer
How do I know PetalBot is the problem?

Search your raw access logs for PetalBot. A few hundred requests a day is normal; tens of thousands from one crawler is worth acting on, especially if load lines up with PHP workers at their limit or high CPU.

Link to this answer
Does PetalBot respect robots.txt?

PetalBot documents that it does. Add a User-agent: PetalBot group with Disallow: / to ban it, or disallow only expensive paths. Changes apply the next time it fetches robots.txt, so it is not instant.

Link to this answer
Where do I add a Cloudflare custom rule?

Under Security, WAF, Custom rules, choose Create rule, name it, edit the expression and set the action to Block. Cloudflare's custom rules replaced the older Firewall Rules screen.

Link to this answer
Should I use Block or Managed Challenge?

Managed Challenge is the cautious first step. Real crawlers cannot solve it so it works almost like a block, and a mistake costs a real visitor one click instead of a blocked page.

Link to this answer
How can I check the rule works?

Run curl -I with the PetalBot user agent against your domain. A blocked request returns 403 with a Cloudflare error page, and a normal request still returns 200. Security Events lists each blocked request.

Link to this answer
Why did my block rule not run?

Cloudflare evaluates custom rules in order, so an earlier allow rule can stop yours running. Move the block above it. Also check that bots cannot reach your origin IP directly.

Link to this answer
What mistakes should I avoid?

Matching a short string like bot, which catches Googlebot and Bingbot and can remove your pages from search. Treating a user-agent string as security, since it is just text.

Link to this answer
Is there a gentler option than blocking?

Yes. A rate limiting rule that matches the same user agent allows Petal Search to index you without hammering the server. Keep the threshold generous at first.

Link to this answer
What else reduces crawler load?

Page caching, a CDN rule that caches static files and blocking internal search results from crawling remove most of the cost, whoever is crawling.

Link to this answer

Keep reading

Want an engineer on it?

Tell us what is wrong in plain words. A person reads it, today.