I have an application for applications that runs REST web services. I want to extract the ip address from all requests processed by my web services.
from javax.servlet.http.HttpServletRequest I try to extract the ip address by checking "X-Real-IP" if empty or unknown checks the first ip in the list of "X-Forwarded-For header, if empty or" unknown. get it from request.getRemoteAddr ().
It seemed to me that I covered all cases, but I still get ip addresses such as 10.xxx or 127.0.0.1 or unknown.
I know that applications for application applications work for load balancers, and instances are dynamic, and of course I omit the header in the request because I can see the source IP address in the logs (from Google).
Edit: all the requests I'm working on are a direct service request (no requests in the queue or cron).
Any idea of other headers to check?
thank.
source
share