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.
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
On this page
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.logon a VPS) and search forPetalBot. 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?
| Option | Strength | Limit |
|---|---|---|
| robots.txt | Gentle, honest crawlers obey it | Not instant; bad bots ignore it |
| Cloudflare custom rule | Stops requests at the edge | A wrong expression can block real visitors |
| Rate limiting | Lets Petal Search index you without hammering | Needs tuning |
How do I apply each option?
Cloudflare's WAF custom rules replaced the older Firewall Rules screen.
- Log in to Cloudflare and choose your domain.
- Go to Security, WAF, Custom rules and click Create rule.
- Name it, for example
Block PetalBot. - Under When incoming requests match, click Edit expression and paste:
(http.user_agent contains "PetalBot") or (http.user_agent contains "PetalSearch")- 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.
PetalBot documents that it respects robots.txt. Add this to the file at your site root:
User-agent: PetalBot
Disallow: /To slow it instead of banning it, disallow only expensive paths:
User-agent: PetalBot
Disallow: /?s=
Disallow: /wp-admin/
Disallow: /*?orderby=Changes are picked up the next time it fetches robots.txt.
If you want Petal Search to index you but not hammer you, add a rate limiting rule that matches the same user-agent expression and allows a modest number of requests per minute from each IP. Cloudflare shows the limits for your plan on the rate limiting page. Set the action to Block for the rest of the window and keep the threshold generous at 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?
| Problem | Why | Fix |
|---|---|---|
| Blocking too broadly | A short string like bot catches Googlebot and Bingbot | Match PetalBot only |
| Rule order | An earlier "allow" rule stops yours running | Move the block above it |
| Origin still exposed | Bots reaching your server IP skip Cloudflare | Restrict the origin to Cloudflare's published ranges |
| Spoofed agents | A user-agent string is just text | Treat 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.
An engineer can read the logs with you.
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 answerWill 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 answerCan 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 answerHow 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 answerDoes 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 answerWhere 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 answerShould 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 answerHow 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 answerWhy 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 answerWhat 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 answerIs 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 answerWhat 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 answerKeep reading
Want an engineer on it?
Tell us what is wrong in plain words. A person reads it, today.