I need to obtain the IP of the request that reaches the Resource for business validation purposes. Please help if someone has done it.
I have tried:
String ipAddress = request.getRemoteAddr();
String ipAddress1 = request.getHeader(“X-Forwarded-For”);
but in the first case it returns the address 0:0:0:0:0:0:0:1 and in the second case null
New contributor
René Ortega is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.