Dynamic IP Whitelisting From A Database

Hi,

We have a software as a service product where each user get’s their own
hosted subdomain like (me.domain.com). We would like to implement
whitelisting, where users can specify certain IP addresses that are
allowed
to view their site. This is implemented like:

location / {
allow 1.2.3.4;
allow 2.3.4.5;
deny all;
}

The problem is that we don’t want to deal with the application code
touching/writing the nginx configuration when a user makes changes to
the
whitelist. I was thinking it would be awesome if nginx could read this
from
a database (MySQL or SQLite), and auto populate the allow list from
that. Is
this possible? If not, what is the best way to implement whitelisting,
without the application code reading and writing the nginx configuration
file.

Posted at Nginx Forum: