{"id":78,"date":"2026-11-01T18:28:16","date_gmt":"2026-11-01T18:28:16","guid":{"rendered":"https:\/\/s4hosting.in\/blog\/?p=78"},"modified":"2026-11-01T19:29:46","modified_gmt":"2026-11-01T19:29:46","slug":"cloudflare-bot-protection-wordpress","status":"publish","type":"post","link":"https:\/\/s4hosting.com\/blog\/cloudflare-bot-protection-wordpress\/","title":{"rendered":"How to Stop Harmful Bots with Cloudflare Without Blocking Genuine Visitors"},"content":{"rendered":"<p>When a WordPress news website receives excessive automated requests, adding more VPS CPU is not always the answer. Cloudflare can reduce unwanted requests before they reach Nginx, PHP-FPM and MariaDB\u2014provided the rules still let genuine readers, verified search crawlers, social preview bots and authorised publishing tools work.<\/p>\n<p>In a recent S4Hosting troubleshooting case involving a high-traffic news portal on a Warsaw VPS, enabling Cloudflare <strong>Under Attack Mode<\/strong> was followed by a drop in one-minute load from roughly 3\u20135 to <strong>0.59<\/strong>, with CPU idle rising above 80% in a subsequent snapshot. That is strong evidence that inbound HTTP request pressure mattered. It does <em>not<\/em> prove every challenged visitor was a malicious bot.<\/p>\n<h2>Quick takeaways<\/h2>\n<ul>\n<li><strong>Block exploit probes<\/strong> and protect WordPress authentication endpoints.<\/li>\n<li><strong>Rate-limit demonstrably abusive crawling<\/strong>, rather than blocking all article visitors.<\/li>\n<li><strong>Preserve verified Google, Bing and Meta crawlers<\/strong> and legitimate news-app traffic.<\/li>\n<li><strong>Protect WordPress APIs and publishers<\/strong> with narrow, authenticated exceptions.<\/li>\n<li><strong>Replace emergency site-wide Under Attack Mode with targeted controls<\/strong> once origin traffic is stable.<\/li>\n<\/ul>\n<figure class=\"wp-block-image size-full\" style=\"margin:28px auto;text-align:center\">\n<img class=\"wp-image-77\" src=\"https:\/\/s4hosting.com\/blog\/wp-content\/uploads\/2026\/11\/s4hosting-cloudflare-traffic-rules.png\" width=\"1448\" height=\"1086\" alt=\"S4Hosting chart of recommended Cloudflare actions for scrapers, vulnerability scanners, crawlers, readers and WordPress publishing automation\" style=\"max-width:100%;height:auto;border-radius:12px\" loading=\"lazy\" decoding=\"async\" srcset=\"https:\/\/s4hosting.com\/blog\/wp-content\/uploads\/2026\/11\/s4hosting-cloudflare-traffic-rules.png 1448w, https:\/\/s4hosting.com\/blog\/wp-content\/uploads\/2026\/11\/s4hosting-cloudflare-traffic-rules-300x225.png 300w, https:\/\/s4hosting.com\/blog\/wp-content\/uploads\/2026\/11\/s4hosting-cloudflare-traffic-rules-1024x768.png 1024w, https:\/\/s4hosting.com\/blog\/wp-content\/uploads\/2026\/11\/s4hosting-cloudflare-traffic-rules-768x576.png 768w\" sizes=\"auto, (max-width: 1448px) 100vw, 1448px\" \/><figcaption>Recommended Cloudflare traffic-handling policy for high-traffic WordPress websites. Review each rule against your own application before enabling it.<\/figcaption><\/figure>\n<h2>Why Cloudflare Under Attack Mode reduced server load<\/h2>\n<p>Cloudflare&#8217;s emergency protection presents Managed Challenges to traffic that may otherwise reach the origin. Clients unable to pass the challenge often do not proceed to WordPress, saving PHP execution, database lookups and uncached-page processing. Cloudflare Security Events can show the actions taken, but a table of challenge events is <strong>not<\/strong> a complete origin traffic count.<\/p>\n<p>In our diagnostic sample, Cloudflare encountered a mixture of headless-browser crawling, requests to obsolete category paths, attempts to probe sensitive configuration files, and traffic apparently associated with legitimate news-app readers and social previews. The operational lesson is to distinguish unwanted automation from useful automated services.<\/p>\n<h2>Step-by-step Cloudflare WAF and bot protection<\/h2>\n<h3>1. Keep Under Attack Mode for emergencies, not as a permanent default<\/h3>\n<p>Open <strong>Cloudflare Dashboard \u2192 select the domain \u2192 Security<\/strong> and review the current security mode and Security Events. If request pressure is actively overwhelming the site, retaining Under Attack Mode temporarily may be justified. Before leaving it enabled indefinitely, check effects on readers, static files, search crawlers and REST API clients.<\/p>\n<p>When targeted WAF and rate-limiting rules are ready and the site is stable, test disabling zone-wide Under Attack Mode while watching origin load and errors.<\/p>\n<h3>2. Block sensitive-file and vulnerability probes<\/h3>\n<p>Under <strong>Security \u2192 Security rules \u2192 Custom rules<\/strong> (labels may vary by dashboard version), create a narrowly scoped <strong>Block<\/strong> rule for confirmed exploit-probe paths. For example:<\/p>\n<pre class=\"wp-block-code\"><code>(http.request.uri.path contains \"\/.env\" or\n http.request.uri.path contains \"\/.git\/\" or\n http.request.uri.path eq \"\/wp-config.php\" or\n http.request.uri.path contains \"\/.aws\/credentials\")<\/code><\/pre>\n<p>This is an illustrative starting point, not a complete vulnerability signature. Keep Cloudflare Managed WAF rules enabled for common exploit techniques. Do not block all POST traffic or all traffic from a country simply because some scanners use it.<\/p>\n<h3>3. Rate-limit repeated WordPress login attempts<\/h3>\n<p>Create a separate rate-limiting rule for repeated <code>POST<\/code> requests to <code>\/wp-login.php<\/code>. Start with a threshold appropriate to real login traffic and use <strong>Managed Challenge<\/strong> or <strong>Block<\/strong> after reviewing events. Enforce strong passwords and multi-factor authentication for privileged users.<\/p>\n<p>If WordPress <code>\/xmlrpc.php<\/code> is definitely unused, consider blocking it; if needed, protect it instead. Avoid blanket restrictions on <code>\/wp-admin\/<\/code>, <code>\/wp-json\/<\/code> or <code>\/wp-admin\/admin-ajax.php<\/code> because valid admin, plugin and publishing workflows can depend on those paths.<\/p>\n<h3>4. Challenge aggressive page crawlers without penalising readers<\/h3>\n<p>Use <strong>Security \u2192 Security rules \u2192 Rate limiting rules<\/strong> to restrict unusually high-frequency HTML or archive requests. Measure the site&#8217;s normal traffic before selecting a threshold: a threshold such as <strong>120 matching requests per minute per source IP<\/strong> may be a starting point for a trial, but it is <em>not<\/em> universally safe. Mobile carriers and offices may have many genuine readers behind one IP, and Cloudflare&#8217;s available rule options vary by plan.<\/p>\n<p>Inspect repeated requests to old endpoints such as <code>\/en\/Categories\/<\/code>, <code>\/te\/Categories\/<\/code> or obsolete <code>.aspx<\/code> paths. Confirm whether these routes should return a redirect before treating them as malicious. Do not rate-limit static image, CSS or JavaScript assets as though they were costly PHP pages.<\/p>\n<h3>5. Preserve verified Google, Bing, Meta and other useful crawlers<\/h3>\n<p>Cloudflare&#8217;s expression field <code>cf.client.bot<\/code> identifies recognised good bots. For broad custom bot-challenge rules, consider an exclusion such as <code>not cf.client.bot<\/code> so that verified crawlers can perform legitimate indexing and link preview retrieval.<\/p>\n<p><strong>Important:<\/strong> Excluding verified bots from your own challenge rule is different from bypassing all security protections. Avoid broad <strong>Skip all remaining custom rules<\/strong> policies that could also bypass sensitive-path protections. Do not trust a claimed Googlebot or Facebookbot user-agent by itself.<\/p>\n<h3>6. Keep WordPress publishing automation working<\/h3>\n<p>Automated news publishers, scheduled imports, webhooks and legitimate API clients can fail if the website-wide challenge is applied to machine-to-machine traffic. Do not globally exempt <code>\/wp-json\/<\/code>. Instead, where necessary, scope a Cloudflare exception to the exact API path and method plus a verified trusted source IP or stronger authentication. WordPress authentication and application-level permissions must remain in force.<\/p>\n<p>A direct-database exporter may bypass Cloudflare completely, but a REST publishing fallback can still be challenged. Test both production and fallback paths after each rule change.<\/p>\n<h3>7. Avoid challenges on genuinely public static images<\/h3>\n<p>If Cloudflare events show repeated challenges on a public <code>.webp<\/code> favicon, JPG or PNG image, check whether it is a false positive. A narrowly scoped configuration exception for that specific asset can reduce disruption to mobile readers and link previews while keeping managed exploit protection active.<\/p>\n<p>Do <strong>not<\/strong> automatically exempt dynamic image proxies or other scripts from WAF checks. They can be abused independently and should have validation, caching and request controls of their own.<\/p>\n<h3>8. Verify the changes and monitor the origin<\/h3>\n<p>After deploying targeted rules, test a logged-out article page, category navigation, static images, search and social previews, WordPress login, API authentication and scheduled publishing. Compare Cloudflare&#8217;s request outcomes with:<\/p>\n<ul>\n<li>Origin requests, cache HIT\/MISS and Nginx 403\/429\/5xx rates.<\/li>\n<li>PHP-FPM worker utilisation and uncached WordPress response times.<\/li>\n<li>MariaDB CPU, SELECT query rates and slow-query patterns.<\/li>\n<li>VPS load averages, available memory and active swap-in\/swap-out.<\/li>\n<\/ul>\n<p>Keep a rollback plan. Once the origin remains stable with targeted controls, retire the temporary full-site Under Attack setting.<\/p>\n<h2>Cloudflare traffic policy: what to block and what to preserve<\/h2>\n<table class=\"wp-block-table\">\n<thead>\n<tr>\n<th>Traffic type<\/th>\n<th>Recommended response<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Aggressive scrapers<\/td>\n<td>Rate-limit, challenge or block demonstrated abuse<\/td>\n<\/tr>\n<tr>\n<td>Repeated high-frequency page crawling<\/td>\n<td>Rate-limit expensive paths based on observed traffic<\/td>\n<\/tr>\n<tr>\n<td>Vulnerability scanners<\/td>\n<td>Block exploit probes; retain managed WAF<\/td>\n<\/tr>\n<tr>\n<td>WordPress brute-force attempts<\/td>\n<td>Protect login and XML-RPC endpoints appropriately<\/td>\n<\/tr>\n<tr>\n<td>Verified Google, Bing and Meta crawlers<\/td>\n<td>Preserve search indexing and social previews<\/td>\n<\/tr>\n<tr>\n<td>Genuine news-app readers<\/td>\n<td>Allow normal browsing and static media requests<\/td>\n<\/tr>\n<tr>\n<td>Authorised publishing automation<\/td>\n<td>Preserve narrowly authenticated API and import workflows<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Frequently asked questions<\/h2>\n<h3>Does Cloudflare Under Attack Mode block every bot?<\/h3>\n<p>No. It challenges eligible requests; some automated clients cannot complete the challenge and therefore do not reach the application. Cloudflare Security Events show actions such as Managed Challenge and Block, which should not be treated as identical.<\/p>\n<h3>Can Cloudflare bot protection hurt Google indexing or Facebook previews?<\/h3>\n<p>Yes, overly broad challenges or skip\/block rules can affect legitimate automated services. Use verified-crawler identification, check actual security events, and test article previews and indexing paths rather than trusting a user-agent string.<\/p>\n<h3>Should we add more VPS CPU when bot traffic causes a load spike?<\/h3>\n<p>First determine whether expensive requests are legitimate and whether caching, WAF and rate limits can reduce unnecessary work. Upgrade capacity when normal traffic and the application workload genuinely require it\u2014not merely to absorb avoidable abuse.<\/p>\n<h2>S4Hosting&#8217;s recommendation<\/h2>\n<p><strong>Protect the origin without blocking the audience.<\/strong> Combine Cloudflare WAF and measured rate limiting with Nginx caching, tuned PHP-FPM concurrency, database query improvements and monitoring. The aim is lower server load <em>and<\/em> reliable access for readers, search crawlers and automated publishers.<\/p>\n<p>For more infrastructure guidance, see our <a href=\"https:\/\/s4hosting.com\/blog\/securing-control-web-panel-cwp\/\">CWP security best-practices guide<\/a> and explore <a href=\"https:\/\/s4hosting.in\/\">S4Hosting&#8217;s hosting services<\/a>.<\/p>\n<h2>Official Cloudflare documentation<\/h2>\n<ul>\n<li><a href=\"https:\/\/developers.cloudflare.com\/waf\/tools\/security-level\/\" target=\"_blank\" rel=\"noopener noreferrer\">Security Level and Under Attack Mode<\/a><\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/waf\/custom-rules\/create-dashboard\/\" target=\"_blank\" rel=\"noopener noreferrer\">Creating custom WAF rules<\/a><\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/waf\/rate-limiting-rules\/create-zone-dashboard\/\" target=\"_blank\" rel=\"noopener noreferrer\">Creating rate-limiting rules<\/a><\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/waf\/custom-rules\/skip\/options\/\" target=\"_blank\" rel=\"noopener noreferrer\">Skip-action scope and options<\/a><\/li>\n<li><a href=\"https:\/\/developers.cloudflare.com\/waf\/custom-rules\/use-cases\/allow-traffic-from-verified-bots\/\" target=\"_blank\" rel=\"noopener noreferrer\">Verified bot traffic<\/a><\/li>\n<\/ul>\n<p><small>Updated 1 November 2026. Cloudflare menus and available controls depend on plan and dashboard version. Review the policy for your environment before deployment.<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to stop harmful bots with Cloudflare WAF, Managed Challenges and rate limiting without blocking real readers, verified crawlers or WordPress APIs.<\/p>\n","protected":false},"author":1,"featured_media":85,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[14,10,12],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloudflare","category-security-performance","category-tutorials"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/s4hosting.com\/blog\/wp-content\/uploads\/2026\/11\/s4hosting-cloudflare-bot-protection-hero.png","_links":{"self":[{"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":2,"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":86,"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/posts\/78\/revisions\/86"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/media\/85"}],"wp:attachment":[{"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/s4hosting.com\/blog\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}