java - request.getRemoteAddr() returns null -
this question has answer here:
- how remote address of client in servlet? 8 answers
i developing application in local machine using tomcat 7 & servlet 3. in trying read client address in servlet identify request coming using request.getremoteaddr() returning null.
i tried metioned here , facing same issue. read using machine name instead of localhost resolve issue. tried using machine name still same issue.
can provide links or solution doc necessary configuration changes retrieve ip address ?
one of possibilities can getremoteaddr() can return null if request has been consumed, means response has been sent. has been noticed in tomcat 7
also fallback can check x-forwarded-for header calling getheader("x-forwarded-for") , see ip return.
Comments
Post a Comment