This is an interesting bit of code. However if you are being ddos-ed, this just eliminates nginx from replying. It isn't like nginx is isolated from the attack. I would still rather block the IP at the firewall and prevent nginx from doing any action.
The use of $bot_agent opens up a lot of possibilities of the value can be fed to the log file.
Original Message
From: shiz
Sent: Wednesday, December 14, 2016 5:24 PM
To: nginx@nginx.org
Reply To: nginx@nginx.org
Subject: Re: limit_req per subnet?
I've inplemented something based on
https://community.centminmod.com/threads/blocking-bad-or-aggressive-bots.6433/
Works perfectly fine for me.
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,271483,271535#msg-271535
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx