Just in case someone else in a similar situation, I managed to solve the problem with js_var (njs module directive: http://nginx.org/en/docs/http/ngx_http_js_module.html#js_var ). From the looks of it nginx (or the geoip2 module) seems to work in a way that it only assigns values to variables at the time they're called. With that in mind, in njs code I parsed the POST body and I took the ip vaby mrw - How to...
Like the title says, I'm curious if it would be possible to somehow read the POST body before the server block (either with a module or with some nginx setting). I'm using the ngx_http_geoip2_module and sometimes the IPs that I need to parse are being passed to me in a POST body and I'm unable to access the POST body in the http block (which is the only place where I can make use of the geoip2by mrw - How to...