php - Nginx replace REMOTE_ADDR with X-Forwarded-For -


i quite new nginx, , seems confusing. have server setup perfectly, problem is, since server protected using http proxy; instead of logging real users ip's, it's logging proxy server ip.

what tried doing setting $_server['remote_addr']; $_server['x-forwarded-for']; i'm getting undefined index error, i'm guessing have define x-forwarded-for in nginx? not aware how so, have simple setup, it's nginx php. nothing more, nothing less.

i've searched on web, can't find information friendly understand.

i have access source code, if helps. i've tried many solutions, no avail.

the correct way of doing setting real_ip_header configuration in nginx.

example trusted http proxy ip:

set_real_ip_from 127.0.0.1/32; real_ip_header x-forwarded-for; 

this way, $_server['remote_addr'] correctly filled in php fastcgi.

documentation link - nginx.org


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -