r/haproxy • • 1d ago

Blocking URLs

I have specific URL patterns that I need to block from AI scrapers. Almalinux box with 64 GB of RAM. Distributed attack. Tens of thousands of unique IP addresses.

Is this a simple configuration? I don’t need to do anything more than block URL regrex patterns before the bots hit nginx in what can only be described as a DDOS attack.

2 Upvotes

1 comment sorted by

3

u/BarracudaDefiant4702 1d ago

Yes, generally that's simple. Here is an example:

acl aclname url,url_dec -i -m reg (?:\${[^}]{0,4}\${|\${(?:jndi|ctx))
acl aclname req.hdrs -i -m reg (?:\${[^}]{0,4}\${|\${(?:jndi|ctx))
http-request silent-drop if aclname

That said, regex's are generally more expensive then other types of acls and if it's a ddos where you are getting 10s of thousand req/sec you might want to have a faster pass/fail before a full regex.