So i thought i would share this here to get some feedback help bring to light some improvements and bugs and to get the ball rolling on how we can make this script better :)
https://github.com/C0nw0nk/Nginx-Lua-Anti-DDoS
I was inspired by Cloudflare HTML _javascript_ based puzzle authentication page to create this so i can use it on my own servers I hope some people find it useful and will help make it better! <3
It is the same as I am under attack mode and the authentication pages of websites under attack on services like Cloudflare, Bitmitigate, Sucuri etc. It takes knowledge of _javascript_, HTML, Nginx, Lua, HTTP Headers, Browsers, Cookies to make this function.
Installation is as simple as download the .lua script put it in your nginx config and then add this to a location or http block or server block in your nginx config to protect those websites or the entire nginx server.
access_by_lua_file anti_ddos_challenge.lua;