Serving a (g)zip bomb with Caddy
Because we can't have nice things on the
web, here is a stupid
trick to kill some bots. First, create a hefty 10TB (g)zip bomb with dd
if=/dev/zero bs=10M count=1G | gzip -9 > /etc/caddy/10T.gzip. Don't worry, this
doesn't take disk space nor ram, only a bit of CPU and some time. Then, put
the following snippet in your Caddy configuration:
handle /trap {
file_server
try_files /etc/caddy/10T.gzip
header Content-Encoding gzip
header Content-Type text/html
}
Hilarious side-note: if you don't put the file_server directive, things won't
work properly and you'll waste a lot of time trying to figure out why.
Anyway, check that things are working with curl --compressed
https://dustri.org/trap --output /dev/null, and if it's the case,
put a Disallow: /trap line in your
robots.txt file,
and add a <a hidden href="./trap">anti-ai trap</a> somewhere on your
webpages.
Congratulations on making the web a better place.