We have to log the client's Ip from the Seam action. Presently, we are while using code:
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext(); HttpServletRequest request = (HttpServletRequest)context.getRequest(); this.remoteAddress = request.getRemoteAddr();
However, this appears to become always coming back an interior address in our network, as opposed to the client's Ip. From the research, it appears that getting a reverse proxy within the network can confuse things, but we may have the ability to repair it by reconfiguring our web servers. Has other people had this issue, and just how have you solve it?
We are using JBoss 5.1 application servers and Apache web servers. Thanks!
You are able to 'see through' a proxy and obtain the address from the original requestor in the
X_FORWARDED_FOR header using
request.getHeader( "X_FORWARDED_FOR" );
I suppose a acting up proxy between your original requestor as well as your server could cause the real value being lost.
The thing you need is perfect for your reverse proxy to pass through the initial Ip inside a special header, like
X_FORWARDED__FOR. After that you can retrieve this header out of your servlet. Furthermore, you might want to modify your log file to log this Ip. Example: