Check your intermediate proxies like nginx, apache, etc if you use one in between of your requests and web application. sometimes proxies manipulate request headers before sending it to web application
for instance for Nginx you could use something like this (source):
proxy_set_header X-Forwarded-For $remote_addr;