remote_addr not set using x-real-ip

ron ramos nhadie at
Mon Jan 26 13:29:17 UTC 2015

Hi All,

I would just like to check what mistake i did on implementing real-ip
Im using nginx 1.6.2 with real_ip_module enabled:

 nginx -V
nginx version: nginx/1.6.2
TLS SNI support enabled
configure arguments: --with-cc-opt='-g -O2 -fstack-protector
--param=ssp-buffer-size=4 -Wformat -Wformat-security
-Werror=format-security -D_FORTIFY_SOURCE=2'
--with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro'
--prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock
--pid-path=/run/ --http-client-body-temp-path=/var/lib/nginx/body
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit
--with-ipv6 --with-http_ssl_module --with-http_stub_status_module*

i have the following entry on nginx.conf

    real_ip_header     X-Forwarded-For;
    real_ip_recursive  on;

and i added the following to format my logs:

log_format custom_logs '"$geoip_country_code" - "$http_x_forwarded_for" -
"$remote_addr" -

in which i get this results:

"-" - "," - "" -
"-" - "," - ""
"-" - "," - ""

the first column does not match any country code on the geoip database
since it is detected as the private IP ( in which this country's ISP seems
to have proxy sending the private IP )

if using real_ip modules i should be seeing the source IP on $remote_addr
in the logs, is that correct? please advise if anyone has encountered the
same issue. thank you in advanced.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list