I recommend you use the ngx_lua module
here's some example (http://openresty.org/#DynamicRoutingBasedOnRedis)
you can change redis to ngx_lua's internal dict facility which is shared between workers for speed.
and write some location handler to accept outside configuration data and save it in ngx_lua's dict.