Q. How does the real IP work in nginx_upstream_module? How do I add the real IP to the header? (2016)
A. You can do it with ngx_http_realip_module: http://nginx.org/en/docs/http/ngx_http_realip_module.html.
Add the header to location and activate this option: https://github.com/tarantool/nginx_upstream_module#tnt_pass_http_request.
Your stored procedure should be able to receive the first argument in the form of an HTTP request (including headers).