Suppose I want to write a nginx module that blocks clients by IP. To do this, at the initialization stage, I read a file with IP addresses that I should block (blacklist) and save it in the context of the module.
Now I want to update the blacklist without restarting nginx. One possible solution is to add a handler to a specific location. for example, if uri "/block/1.2.3.4" is requested, my handler adds the ip address 1.2.3.4 to the blacklist.
However, nginx runs several workers as separate processes, so only one specific worker is updated.
What is the general solution to such problems?
source share