A user of Corvus , my open-source gateway on top of
OpenResty, opened a short issue: "This community blocklist is 50 MB and fails to download (limit
is 5 MB). Please support larger blocklists."
Raising the limit would have taken one line. It would also have been a bad idea, and fixing it
properly turned into one of the more satisfying pieces of work on the project. This post is about
that fix, because the technique works for any nginx/OpenResty setup that needs to check client
addresses against a big list.
Why raising the limit wasn't enough
The list in question has about 3.9 million IPv4 addresses and networks, one per line. At the
time, Corvus handled IP lists the obvious way: the control plane stored the entries, wrote them into
the gateway's rule file, and every nginx worker loaded them into a Lua table when the configuration
loaded.
That's fine for a few thousand entries.…