Incorrect IP Address Deducted by Nginx version: nginx/1.2.1

sivakr nginx-forum at nginx.us
Wed Feb 19 14:36:15 UTC 2014


Hi,

     We have strange issue on our swiss based on server.

	Issue:  Incorrect IP Address value in REMOTE_ADDR Header 

               Nginx Version : 1.2.1

              Server OS : Debian 7.1

              Modules : 	

 		nginx -V
nginx version: nginx/1.2.1
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-client-body-temp-path=/var/lib/nginx/body
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi
--http-log-path=/var/log/nginx/access.log
--http-proxy-temp-path=/var/lib/nginx/proxy
--http-scgi-temp-path=/var/lib/nginx/scgi
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock
--pid-path=/var/run/nginx.pid --with-pcre-jit --with-debug
--with-http_addition_module --with-http_dav_module --with-http_geoip_module
--with-http_gzip_static_module --with-http_image_filter_module
--with-http_realip_module --with-http_stub_status_module
--with-http_ssl_module --with-http_sub_module --with-http_xslt_module
--with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl
--with-mail --with-mail_ssl_module
--add-module=/tmp/buildd/nginx-1.2.1/debian/modules/nginx-auth-pam
--add-module=/tmp/buildd/nginx-1.2.1/debian/modules/nginx-echo
--add-module=/tmp/buildd/nginx-1.2.1/debian/modules/nginx-upstream-fair
--add-module=/tmp/buildd/nginx-1.2.1/debian/modules/nginx-dav-ext-module


   We have IP based security token for our application , the token created
by nginx+php will be checked in wowza before stream play. Recently lot of NZ
visitors complained about video not playing , it due to security token
failed between nginx+php vs wowza. here are more information


            1 .  We have installed Apache on same server and deduction IP
Address as expected.

            2.   Even Nginx access log printing incorrect IP Address , so we
feel nothing missed on FastCGI setting

            3.  Based on IPLocation info incorrect IP is gateway IPAddress

            NGINX $_SERVER 


            Array
(
    [FCGI_ROLE] => RESPONDER
    [SCRIPT_FILENAME] => xxxxxx
    [QUERY_STRING] =>
msg=Error%20loading%20stream:%20Could%20not%20connect%20to%20server
    [REQUEST_METHOD] => GET
    [CONTENT_TYPE] => 
    [CONTENT_LENGTH] => 
    [SCRIPT_NAME] => /trackfail.php
    [REQUEST_URI] =>
/trackfail.php?msg=Error%20loading%20stream:%20Could%20not%20connect%20to%20server
    [DOCUMENT_URI] => /trackfail.php
    [DOCUMENT_ROOT] => xxxxx
    [SERVER_PROTOCOL] => HTTP/1.1
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_SOFTWARE] => nginx/1.2.1
    [REMOTE_ADDR] => 210.x5.2x2.93
    [REMOTE_PORT] => 60187
    [SERVER_ADDR] => xxxxxxx
    [SERVER_PORT] => 80
    [SERVER_NAME] => xxxxx
    [HTTPS] => 
    [REDIRECT_STATUS] => 200
    [GEOIP_COUNTRY_CODE] => NZ
    [GEOIP_COUNTRY_NAME] => New Zealand
    [HTTP_HOST] => xxxxxxx
    [HTTP_ACCEPT] => */*
    [HTTP_X_REQUESTED_WITH] => XMLHttpRequest
    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
    [HTTP_REFERER] => xxxxxxxxxxxxxx
    [HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch
    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8
    [HTTP_COOKIE] => zmad=1; 2bfd_unique_user=1; defaults=1
    [HTTP_CACHE_CONTROL] => max-stale=0
    [HTTP_CONNECTION] => Keep-Alive
    [PHP_SELF] => /trackfail.php
)

   Apache $_SERVER


          Array
(
    [GEOIP_ADDR] => 115.1x8.3x.37
    [GEOIP_CONTINENT_CODE] => OC
    [GEOIP_COUNTRY_CODE] => NZ
    [GEOIP_COUNTRY_NAME] => New Zealand
    [HTTP_HOST] => xxxx:8080
    [HTTP_CONNECTION] => keep-alive
    [HTTP_ACCEPT] => */*
    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
    [HTTP_REFERER] => xxxx
    [HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch
    [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8
    [HTTP_COOKIE] => zmad=1; 2bfd_unique_user=1; defaults=1
    [PATH] => /usr/local/bin:/usr/bin:/bin
    [SERVER_SIGNATURE] => <address>Apache/2.2.22 (Debian) Server at xxxxx
Port 8080</address>

    [SERVER_SOFTWARE] => Apache/2.2.22 (Debian)
    [SERVER_NAME] => xxxxxx
    [SERVER_ADDR] => xxxxx
    [SERVER_PORT] => 8080
    [REMOTE_ADDR] => 115.1x8.3x.37
    [DOCUMENT_ROOT] => xxxxxx
    [SERVER_ADMIN] => webmaster at localhost
    [SCRIPT_FILENAME] => xxxxxxx
    [REMOTE_PORT] => 51777
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] => reqid=662&callback=jsonCallback&_=1392745097470
    [REQUEST_URI] =>
/trackfail.php?reqid=662&callback=jsonCallback&_=1392745097470
    [SCRIPT_NAME] => /trackfail.php
    [PHP_SELF] => /trackfail.php
)
         
          	
Thanks
Siva

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,247736,247736#msg-247736



More information about the nginx mailing list