Thursday, October 1, 2009

Remote Address and Remote Host



Remote Host - This can be defined as "fully qualified name" of the Client that sent the request.
For example in the above image request is being sent to server from host name www.example.in. So request.getRemoteHost() returns the name of host from which jsp page are being accessed. If  user is accessing it from server then it will return server name.

    String remoteHost = request.getRemoteHost();

When request is done via proxy server then for all users behind the proxy "remote address" will be same and the actual user's IP address will be not be visible to outside world unless proxy forward actual user IP in X-Forwarded-For header.

Remote Address - This can be defined as IP address of the Client that sent the request. In the above image request to server is being sent from IP add 108.122.146.173 so the request.getRemoteAddr() will return IP address of the machine from where jsp page is being accessed.

No comments:

Post a Comment