remote_addr not set using x-real-ip

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


Hi All,

I would just like to check what mistake i did on implementing real-ip
module.
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
--http-log-path=/var/log/nginx/access.log
--error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock
--pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit
--with-ipv6 --with-http_ssl_module --with-http_stub_status_module*
--with-http_realip_module*


i have the following entry on nginx.conf

    real_ip_header     X-Forwarded-For;
    set_real_ip_from   0.0.0.0/0;
    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:

"-" - "172.16.8.39, 102.103.104.105" - "172.16.8.39" -
"-" - "172.16.23.72, 203.204.205.206" - "172.16.23.72"
"-" - "172.16.163.36, 13.14.15.16" - "172.16.163.36"

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.

Regards,
Ron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150126/8c31f7d1/attachment.html>


More information about the nginx mailing list