The ngx_http_realip_module module is used to change the client address and optional port to the one sent in the specified header fields.
Cookbook of SlapOS recipes.