x-real-ip issue

CJ Ess zxcvbn4038 at gmail.com
Mon Aug 28 18:25:06 UTC 2017

I've been struggling all day with this, I'm missing something, hoping
someone can point out what I'm doing wrong w/ the realip module:

  log_format xyz '$remote_addr - $remote_user [$time_iso8601] '
                    '"$request" $status $body_bytes_sent '
                    '"$http_referer" "$http_user_agent"
"$http_x_forwarded_for" $http_x_real_ip';

  access_log  /var/log/nginx/access.log xyz;
  real_ip_header X-Forwarded-For;
  real_ip_recursive on;

Test command I'm running:
curl -v -v -v -H "Host: www.test.com" -H "X-Forwarded-For:,"

What I see in the error log: - - [2017-08-28T14:20:38-04:00] "GET /cheese HTTP/1.1" 502 166
"-" "curl/7.29.0" "," -

I'm expecting that either $remote_addr or $http_x_real_ip be, but
the former is and the latter is null.

I've tried two versions of Nginx including the latest, so pretty sure its
an issue with my config. The config test is successful, no errors in the
error log (level debug), the 502 status code is expected and shouldn't
impact the realip module.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170828/4c12a303/attachment.html>

More information about the nginx mailing list