4 ms·
For millions of IPs I put them all in redis as a key, and wrote some Lua code for nginx. The lua code would do a key look up in redis, and store the result of t
by lovehashbrowns 4y ago
For millions of IPs I put them all in redis as a key, and wrote some Lua code for nginx. The lua code would do a key look up in redis, and store the result of that lookup in cache. If the IP was in redis as a key, nginx would let the request time out. No error of any kind.
I also had to update that IP blacklist daily so that’s also why I chose redis.
Probably better ways to do it nowadays but that’s what I did like 8 years ago and it’s still one of my favorite solutions ever.
Also part of why nginx and redis will forever be two of my favorite technologies alongside Linux.