As was noted by someone on my post (that you linked), apparently, you can have NGINX handle this for itself: Module ngx_http_realip_module
As was noted by someone on my post (that you linked), apparently, you can have NGINX handle this for itself: Module ngx_http_realip_module