How to Slow Down Scrapers That Hammer Your WordPress Site

How to Slow Down Scrapers That Hammer Your WordPress Site

A scraper that hits your WordPress site hundreds of times a minute does more than waste bandwidth. It eats PHP workers and can push a small VPS into swapping during peak hours. If you want to slow down wordpress scrapers before they drag your site to a crawl, you need more than a robots.txt file. Most aggressive scrapers ignore it. The fixes that actually work sit at the server level: rate limits, firewall rules, and traps that catch bots while real visitors pass through untouched.

How to Tell Scrapers Apart From Real Visitors

Before you block anything, look at what is actually hitting your site. Open your nginx access log and sort by IP address. A real visitor loads a page, a few images, and maybe a stylesheet, then pauses. A scraper requests page after page with no pause, often asking for the same URL patterns in alphabetical order or hammering your search endpoint with random terms.

Check the user agent too. Some scrapers announce themselves with names like “python-requests” or a headless browser string. Others copy a Chrome user agent, so the string alone tells you nothing. The giveaway is behavior: dozens of requests per second from one IP, no referrer, no cookies accepted, and requests for URLs that only exist in your sitemap.

One warning: shared IPs hide real people. A university network, a corporate NAT, or a mobile carrier can put hundreds of genuine readers behind one address. Never block an IP on a single spike. Watch it for ten minutes first, and check whether any of its requests look like a human browsing a post.

Slow Down WordPress Scrapers With Rate Limits

Rate limiting is the single most effective way to slow down wordpress scrapers without touching your theme or installing another plugin. Instead of refusing requests outright, you cap how many a single IP can make in a short window. A human who clicks through five posts in a minute never notices. A scraper firing 30 requests a second gets throttled to a crawl.

In nginx, the limit_req_zone directive sets this up in a few lines. A common starting point is 10 requests per second per IP, with a small burst allowance for pages that load several assets at once. Apply the limit to your PHP location block rather than to static files, so images and CSS do not count against a visitor’s budget. When the limit trips, nginx answers with a 503, and the scraper has to wait.

WordPress has its own hot spots worth limiting harder. The search endpoint, /?s=, and the REST API route /wp-json/wp/v2/search attract scrapers that harvest your content through queries. Give those paths a stricter limit, such as one request per second per IP.

The limit is a trade-off. Set it too low and a reader who opens several tabs at once gets 503 errors. Set it too high and scrapers barely feel it. Start at 10 requests per second, watch your error log for a day, and tighten only if the junk traffic keeps coming. For a full walkthrough of the directives, see this guide on how to rate limit nginx to stop brute force and scraping bots.

Block the Worst Offenders at the Nginx Level

Rate limits slow bots down. Some bots deserve a flat refusal. If an IP has made thousands of requests in an hour and every one of them looks automated, return a 444 in nginx, which drops the connection without sending a response body. That saves your bandwidth and your PHP workers in one move.

A simple map block can match known bad user agents and send them straight to a 403. Empty user agents, ancient bot strings, and tools like HTTrack or Scrapy are fair game. Scrapers rotate user agents, so pair it with behavior rules: an IP that requests your sitemap, then every post URL within two minutes, is not a reader.

Fail2ban adds the missing piece by turning log patterns into temporary firewall blocks. A jail that watches your nginx access log for repeated 404s or rapid-fire requests can ban an IP for an hour after a set number of hits. The ban lifts on its own, so a false positive fixes itself. This fail2ban setup guide for SSH and nginx on Ubuntu shows the same pattern applied to web traffic.

The drawback is maintenance. Block lists go stale, and a scraper that switches IPs every few minutes will slip past a ban aimed at one address.

Add a Honeypot Trap for Bots That Ignore robots.txt

Well-behaved crawlers read robots.txt and respect it. Aggressive scrapers do not. A honeypot trap turns that into an advantage: put a link in your page footer that no human can see, such as a hidden link to /trap-for-bots/, and block any IP that follows it. A real visitor never clicks an invisible link. A scraper that follows every href on the page walks straight into the trap.

The trap page itself can be a plain text file that returns a 403, or a small script that logs the IP and adds it to a block list. Keep it simple. The point is detection, not punishment. Once an IP touches the trap, you know it is a bot, and you can rate limit it hard or block it for a day.

This method has limits. A scraper that only requests URLs from your sitemap never sees the hidden link. A scraper that renders pages with a headless browser may also skip invisible links. Treat the honeypot trap as one signal among several, not as your only defense.

Cache Aggressively So Scrapers Cost You Less

You cannot always stop a scraper from requesting pages, but you can make each request cheap. With nginx FastCGI cache turned on, the first request for a post builds the page, and every later request serves the cached HTML without touching PHP or MySQL. A scraper that fetches the same 200 posts in a loop then costs you almost nothing after the first pass.

Cache rules matter here. Cache public post and page URLs for at least an hour, but exclude the admin area, the cart, and any page that shows a logged-in user. A stale cache that shows one visitor another visitor’s account details is worse than no cache at all. Test your rules with two browsers, one logged in and one not, before you call it done.

Page caching also changes how rate limits feel. A cached request still counts against a limit in nginx, so a scraper can trigger 503s for itself while your server stays idle. For the setup details, this guide to blocking bad bots and scrapers with nginx rules covers the same ground from the firewall side.

Use Cloudflare Rules to Slow Bots Before They Reach Your VPS

Everything above runs on your own server, which means junk traffic still reaches your VPS and still costs you bandwidth. A CDN in front of your site can filter much of it before it ever arrives. Cloudflare’s free plan includes a managed challenge for known bots and a bot fight mode that serves a JavaScript challenge to automated clients.

Custom firewall rules give you finer control. You can challenge or block requests that hit your search endpoint more than a set number of times, or that request your XML sitemap dozens of times an hour. Rate limiting rules at the edge work the same way as nginx rate limiting, but they run on Cloudflare’s network, so your server never sees the rejected requests at all.

There are trade-offs. A JavaScript challenge can lock out readers who use text-only browsers or aggressive privacy extensions. Cloudflare also becomes a single point of failure: if its edge has a bad day, your site goes dark for everyone, not just bots. Use the lightest challenge that stops the abuse. This walkthrough of Cloudflare security settings, WAF rules, bot fight mode and SSL modes explains each setting before you switch it on.

Watch Your Logs and Tighten the Rules Over Time

No single rule set stays effective for long. Scrapers change user agents, rotate IPs, and slow their request rate to sit just under your limits. A weekly look at your logs keeps you ahead of that drift. Check which IPs made the most requests, which URLs got hit hardest, and whether your 503 and 444 responses are climbing.

Set up a simple alert for the signals that matter: a sudden jump in total requests, PHP-FPM hitting its worker limit, or disk space shrinking because the access log doubled in size overnight. Tools like nginx rate limiting with limit_req only help if you notice when they start working overtime.

Keep a short note of what you change and when. When a real visitor reports a 503 error, that note tells you which rule to loosen. Slow, steady tuning beats a big block list you never revisit.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.