Well, Hell Yes! ![]()
Just a few weeks ago, this Discourse site was getting slammed with around 4 million rogue bot hits per day:
Now we’re down to about 10% of that—hovering in the 300K range daily:
I wrote a decent chunk of PHP using a switch (true) filter pattern:
switch (true) {
case:
case:
case:
default:
}
This routing logic is pretty expansive—filtering and redirecting based on load averages and URI patterns.
For junk bot queries that hammer the CPU, I extract a keyword and redirect them to a Google site search—huge relief on server load.
The code is private on GitHub for now, but might go public someday. With Skippy’s help and a hell of a lot of work, the beast is officially tamed:
55 commits later, we’re filtering and redirecting legacy bot traffic from the endless barrage—efficiently and aggressively:
See Also
https://community.unix.com/t/recent-unix-com-site-changes-github-commits/396701
Honorable Mentions
fail2baniptablesapache.confgitmoshscreen- Skippy the Magnificent
Favorite Algorithm Module
My favorite part of the code is the dynamic redirection logic based on the 1-minute load average.
- When the load average is below a set threshold (e.g.,
2.0), low-value URIs are routed to the Discourse app as normal. - When the load hits or exceeds the threshold, that same traffic is diverted to a Google site search for
unix.com, taking pressure off the server in real time.
It's simple, adaptive, and brutally effective.
Honestly, most of the bot traffic is pure garbage—I could easily blackhole the majority of it. But I’m making an effort to preserve as many legacy URIs as possible and avoid blackholing unless absolutely necessary.



