Control Systems SecuritySubscribe
← Back to Articles

How I Blocked AI Scrapers From Draining My Server Bandwidth

Published: August 22, 2026 — ~8 min read  |  By Jeff Gray

On August 22, 2026, a single scraper consumed 69% of all traffic to my website in one day. It pulled 2,188 requests from six Amazon Web Services IPs, burning through 13 MB of my 19.3 MB daily bandwidth. Zero humans. Zero revenue. Zero value. (All IP addresses and server paths in this article have been sanitized for security.) Just a Python library called Trafilatura running through my entire site like it was a free all-you-can-eat buffet.

Here's exactly how I found it, blocked it, and built a defense that holds against rotation.

The Discovery

I run a standard Nginx setup on a small VPS. My access logs record every request — status code, IP, user agent, path. When I pulled the daily traffic report, something was wrong:

The numbers that told the story:
• Total requests: 3,167
• Unique IPs: 401
• Requests from 6 AWS IPs: 2,188 (69%)
• User agent: trafilatura/2.0.0
• Bandwidth consumed: 13 MB of 19.3 MB total (68%)
• All requests returned 200 — they were getting everything

The pattern was unmistakable. Every article on the site received exactly 40–52 hits from these IPs. This wasn't targeted reconnaissance — it was a full-site crawl. Every page, every post, downloaded and parsed.

Who's Behind It?

I don't know, and that's the point. Trafilatura is an open-source Python library for content extraction. Anyone can use it. The six IPs were all from Amazon Web Services:

IP AddressRequestsProvider
3.139.x.x528AWS Ohio
3.138.x.x378AWS Ohio
3.129.x.x336AWS Ohio
3.148.x.x270AWS Ohio
3.142.x.x270AWS Ohio
18.219.x.x180AWS Ohio

Could be an AI company training models. Could be a content aggregator. Could be a researcher. Could be someone who just spun up six EC2 instances on a free trial. The point is: it doesn't matter. Your server resources are finite. Your bandwidth costs money. You don't owe free access to every script that points at your URLs.

The Four-Layer Defense

Here's the exact Nginx configuration I built. It's in a file called /bot-block.conf, included from the main Nginx config.

Layer 1: User-Agent Blocking

This catches scrapers that announce themselves:

map $http_user_agent $bad_ua {
    default 0;
    ~*Go-http-client 1;
    ~*python-requests 1;
    ~*Scrapy 1;
    ~*curl 1;
    ~*wget 1;
    ~*libwww-perl 1;
    ~*httpclient 1;
    ~*HTTPie 1;
    ~*Java/ 1;
    ~*trafilatura 1;
    ~*ClaudeBot 1;
    ~*PerplexityBot 1;
    ~*Reflectionbot 1;
    ~*Barkrowler 1;
    ~*ScryBot 1;
    ~*PetalBot 1;
}

The map directive in Nginx evaluates every incoming request's User-Agent header. If it matches any of these patterns, the variable $bad_ua is set to 1. Then in the server block:

server {
    if ($bad_ua) { return 444; }
}

444 is an Nginx-specific status code that closes the connection without sending any response. It's the digital equivalent of hanging up the phone. The scraper gets nothing — no HTML, no error page, no data at all.

Layer 2: IP Blocking (Geo Block)

User agents are easy to spoof. So I added IP-level blocking for the specific addresses that were hitting me:

geo $bad_ip {
    default 0;
    3.138.x.x 1;
    3.148.x.x 1;
    3.142.x.x 1;
    3.139.x.x 1;
    3.129.x.x 1;
    18.219.x.x 1;
    3.149.x.x 1;
}

Combined with the server block:

server {
    if ($bad_ip) { return 444; }
}

Now even if the scraper changes its User-Agent to look like a normal browser, the IP itself is blocked. And if it spins up new AWS IPs, those get caught by the User-Agent rule. Both layers must be bypassed simultaneously for the scraper to get through.

Layer 3: Rate Limiting

For scrapers that don't match known patterns but still hit too fast:

limit_req_zone $binary_remote_addr zone=css_general:10m rate=20r/s;
limit_req_zone $binary_remote_addr zone=css_api:10m rate=10r/s;
limit_req_zone $binary_remote_addr zone=css_feed:10m rate=5r/s;

server {
    location / { limit_req zone=css_general burst=40 nodelay; }
    location /api/ { limit_req zone=css_api burst=20 nodelay; }
    location /feed.rss { limit_req zone=css_feed burst=10 nodelay; }
}

This limits any single IP to 20 requests per second for general content, 10 for API endpoints, and 5 for RSS feeds. The burst parameter allows short spikes, and nodelay serves them immediately rather than queueing. This catches scrapers that rotate User-Agent strings but maintain high request rates.

Layer 4: The Honeypot

I route WordPress attack probes to a honeypot that logs the attacker's IP and user agent:

location = /wp-login.php {
    access_log /var/log/nginx/honey.log honey;  # log path redacted for security
    alias /var/www/html/honeypot.html;
    default_type text/html;
}

WordPress doesn't run on this server. Every request to /wp-login.php, /xmlrpc.php, or /wp-content/ is an automated scanner. The honeypot logs them for analysis without giving the scanner anything useful.

The Result

After deploying this configuration and reloading Nginx, the scraper's requests dropped to zero. Here's what the logs showed in the final minutes before the block went live:

18.219.x.x - - [22/Aug/2026:22:39:58 +0000] "GET /posts/447k-write-capable-ics-devices-what-defenders-need-to-know.html HTTP/1.1" 444 0
18.219.x.x - - [22/Aug/2026:22:39:58 +0000] "GET /posts/447k-dispatch-with-charts.html HTTP/1.1" 444 0

Every request returned 444 — connection closed, zero bytes sent. The scraper got nothing. Today, those seven IPs haven't returned a single request.

What About robots.txt?

I didn't rely on robots.txt for enforcement. A robots.txt file is advisory — it tells cooperative bots where not to go. The scraper I blocked didn't care about robots.txt. It made 161 requests for /robots.txt today, all returning 404 because I didn't have one. I've since added one, but it's a courtesy, not a defense.

Think of it this way: a "No Trespassing" sign is meaningful only to people who intend to respect it. The scraper didn't care about the sign. I needed a fence.

What About Cloudflare?

Cloudflare's bot management is excellent if you're behind their CDN. I run Nginx directly on a VPS without a CDN layer. For operators who do use Cloudflare, the same principles apply — but you'd implement bot rules through Cloudflare's dashboard rather than Nginx config. The layers are the same: identify, block, rate-limit, and log.

Practical Takeaways

  1. Monitor your access logs. You can't block what you can't see. Pull your daily request counts, unique IPs, and user agent distribution at least weekly.
  2. Block at multiple layers. User-Agent alone is trivial to bypass. IP alone is trivial to rotate. Combine them so the scraper must defeat both simultaneously.
  3. Use 444, not 403. A 403 response still sends bytes to the scraper. A 444 closes the connection with zero data transfer. It's faster, cheaper, and more hostile.
  4. Rate limit everything. Even if you can't identify the scraper, limiting any single IP to 20 requests per second makes full-site crawling impractical.
  5. Log everything. Your Nginx access log is your evidence. When you see a pattern, you can block it. When you block it, you can verify it worked.

The internet is full of scrapers. Your server doesn't have to serve them.

For a deeper dive, the OT Security Risk Management Guide v3.0 includes comprehensive frameworks for NERC CIP, ISA/IEC 62443, and NIST CSF 2.0 compliance.

By Jeff Gray | All Articles