I've noticed in our access logs that sometimes, the $http_x_forwarded_for
variable has not been set, and instead, the correct IP is the one set to $remote_addr
. Is it possible to set $http_x_forwarded_for
as $remote_addr
, when it doesn't otherwise exist?
Basically, the following psuedo code, in nginx logic:
if($http_x_forwarded_for == null) $http_x_forwarded_for = $remote_addr
I base some limit req zones on the $http_x_forwarded_for
, so I think this issue could be why it doesn't always take effect.
Thanks.