CLAUDEBOT CRAWLED THE CRAP OUT OF MY GIT SERVER?! 203,000 Requests in 4 Hours — and the 3-Line NPM Block That Killed It

CLAUDEBOT CRAWLED THE CRAP OUT OF MY GIT SERVER?! 203,000 Requests in 4 Hours — and the 3-Line NPM Block That Killed It

I self-host all my git on git.lightgui.com — every repository, every release, on a machine I own, behind a login I control. The forge went live on December 5, and within its first four hours it had taken about 203,000 requests. One visitor was responsible for roughly 60% of them: ClaudeBot, Anthropic's crawler. Real git use in the same window? Three clone/fetch operations and fifteen release downloads. The rest was a bot reading my code for its training data, one page at a time, as fast as it could go.

This is what it cost, how I caught it, and the three-line block in Nginx Proxy Manager that stopped it cold — with the exact configuration and the live verification, because every number here was measured on the server while writing. The setup it defends is the one from the Gitea self-hosting article, and the monitoring that caught the flood is the Prometheus + Grafana stack — though, as that article admits, Gitea exposes no request metrics at all, so the traffic numbers here come from the GoAccess report instead.

The flood, in numbers

The forge went live, and the first thing I did was look at the traffic. A second GoAccess report watches the git vhost alone — traffic.hotconfig.com/git.html — and what it showed in the first four hours was not a community discovering a new forge. It was one crawler eating it:

WhatMeasured
Requests in the first ~4 hours~203,000
ClaudeBot's share of them~60%
Real clone/fetch operations (git-upload-pack)3
Release downloads15
Gitea container CPU while "idle"27–50%
Host load average4.15 / 5.31 / 5.53

Read that again: 203,000 requests, and 18 of them were a human being doing something with git. Everything else was a bot asking for pages. And the CPU is the part that stings — the Gitea container was burning a quarter to a half of a core doing nothing but answering a crawler, on a server that is supposed to be idle between my own pushes.

What ClaudeBot actually is

ClaudeBot is Anthropic's web crawler. It walks public sites and reads the pages, and the content it collects feeds Claude — training data and search results. It is not malware and it is not hiding: it announces itself honestly in its User-Agent header, it comes from Anthropic's published IP ranges, and in principle it respects robots.txt. None of that makes it free. Every page it asks for is a page my server has to render, and a git forge is not a static site — there is nothing cheap for it to read.

That is the part people miss when they say "it's just a crawler, let it crawl." A static blog post costs a file read. A Gitea repository page costs a Go template render, a pile of SQLite queries, and a walk over git objects — for every repository, every file listing, every commit page, every tag. Multiply that by 120,000 requests in four hours and the "idle" server is not idle. The crawler is not attacking anything. It is just expensive, and it never stops, and it never asked.

Why it burns CPU: Gitea renders everything, live

The honest question I asked first was whether the CPU was Gitea's own fault — some background job, some indexer, some runaway task. It was not. Gitea's background work is light and periodic: repository statistics, garbage collection, the occasional maintenance pass. None of it sustains 27–50% CPU. The CPU tracked the request rate, and the request rate was ClaudeBot.

The second honest limit is worth stating, because it decides what you can even see: Gitea 28.4.0 exposes no HTTP-request metrics, no clone/fetch counters, and no database metrics. The Grafana dashboard from the monitoring article can show you repository counts and Go runtime numbers, but it cannot show you who is hitting the forge — there is no metric for it, and inventing one would be lying with a graph. The only reason I know ClaudeBot did this is the access log, read through GoAccess. If you self-host a forge and you are not watching the access log, you will not know a crawler is eating it. You will just notice the server feels warm.

The fix: three lines in Nginx Proxy Manager

The forge sits behind Nginx Proxy Manager — proxy host 17, git.lightgui.com to 172.93.49.176:3000. The block went into that host's advanced config, via the NPM API, so the request is refused before it ever reaches Gitea:

if ($http_user_agent ~* "ClaudeBot") {
    return 403;
}

Two things about that rule. The ~* is a case-insensitive regex match on the User-Agent header, so ClaudeBot, claudebot, and any casing in between all trip it. And return 403 happens in nginx, before the proxy — Gitea never sees the request, never renders a page, never spends a cycle. The whole flood now costs one regex test per request.

The change was made through the NPM API with a small script on the server, /root/block-claudebot.py, which reads the existing host, sets advanced_config to the block, and PUTs the host back with every other field preserved — access list, certificate, SSL settings, all of it untouched. The API answered nginx_online: true and nginx_err: null, and the generated 17.conf carries the block. Nothing else was re-saved: the traffic-stats access list was never touched, and proxy host 12 — the one with the hand-added SSL block — was never opened.

Belt and braces: robots.txt

A 403 is a wall, but a polite sign costs nothing too, so ClaudeBot also gets a robots.txt. One gotcha: Gitea 28.4.0 returns 404 for /robots.txt by default — but it serves a custom file from <CustomPath>/public/robots.txt. So the file went to /opt/gitea/data/gitea/public/robots.txt:

User-agent: ClaudeBot
Disallow: /

Note what is not in there: there is no User-agent: * rule. This file says nothing to any other crawler. Googlebot and GPTBot are unaffected, and search indexing of the public repositories still works. The 403 does the real work; the robots.txt is there for the crawlers that read the sign before knocking.

What I deliberately did not block

Only ClaudeBot is blocked, and only on the git host. Googlebot and GPTBot are a small share of the traffic, and having the public repositories indexed is useful — there is no reason to burn that. The block is scoped to proxy host 17, so the blogs are untouched: a ClaudeBot user agent hitting www.lightgui.com or www.lzply.com still gets a 200. And the htpasswd gate in front of the traffic stats is intact — ClaudeBot gets a 401 there, same as everyone without credentials.

Verification, all live

Every row below was run from the server after the block landed:

RequestResult
ClaudeBot user agent → git.lightgui.com403
Mixed-case claudebot user agent → git.lightgui.com403
Normal Chrome user agent → git.lightgui.com200
Googlebot user agent → git.lightgui.com200 — not blocked
GPTBot user agent → git.lightgui.com200 — not blocked
Real git ls-remote https://git.lightgui.com/thinkmelt/lightgui.gitWorks
traffic.hotconfig.com, ClaudeBot user agent401 — gate intact
traffic.hotconfig.com, normal user agent401 — gate intact
www.lightgui.com, ClaudeBot user agent200 — blogs not blocked
www.lzply.com, ClaudeBot user agent200 — blogs not blocked

Real git still works, real browsers still work, the other crawlers still work, and ClaudeBot gets a 403 for every casing of its own name. The forge is back to the CPU it should have — answering me.

The honest limits

A user-agent block only stops a crawler that tells the truth about who it is. ClaudeBot does, which is why this works. Any client can lie about its User-Agent header, and a scraper that spoofs Chrome sails straight through this rule — the fix stops the declared crawler, not a hostile one. Likewise, robots.txt is a request, not a wall: it binds only crawlers that choose to read it. If the flood ever comes back wearing a borrowed name, the next step is rate limiting by request rate, not by identity — and the GoAccess report will be the thing that shows it, because it is still counting.

And one correction to the record, stated plainly: my first instinct was to blame Gitea's background tasks for the CPU. The log said otherwise. The background jobs are light and periodic; the crawler was the load. Check the log before you blame the software.

Do it yourself

If you run anything public behind Nginx Proxy Manager and a crawler is eating it, the whole fix is two moves. First, the block — in the proxy host's Advanced tab, or through the API the way I did it:

if ($http_user_agent ~* "ClaudeBot") {
    return 403;
}

Swap in any user agent you want gone, and scope it to the one proxy host that needs it — never to the whole proxy. Second, the sign — a robots.txt naming only that crawler, so the well-behaved ones keep their manners and everyone else is untouched. Then verify both ways: the blocked agent gets a 403, a normal browser gets a 200, and a real git ls-remote still works. If any of those three is wrong, the block is wrong.

Conclusion

Self-hosting means the traffic is yours — all of it, including the parts you never invited. A public forge with no crawler policy is a free buffet for every training bot on the internet, and the bill arrives as CPU on a server that should be idle. The fix is three lines, scoped to one host, verified both ways, and the forge is mine again — 403 for the bot, 200 for everyone else. Watch your access log. It is the only metric Gitea will not give you.

References: Self-hosting git with Gitea · Gitea Prometheus metrics + Grafana · GoAccess git traffic report · thinkmelt/lightgui on Gitea · Gitea

Linux Rocks Every Day