Feature #1566
get ip address from client
0%
Description
Is it possible to get the ip address of the client?
I have tried request.headers.connection.remoteAddress but that seems te be empty
History
Updated by Patrick Talbot about 5 years ago
Try the new version 3.5.76 - I've added request.remoteAddress, request.remoteHost, request.remoteUser
They will be filled IF available.
remoteAddress might be the address of a proxy if you are using one, in which case you will need to examine the request.headers to check if the proxy exposes the remote address (via a X-FORWARD-FOR for example)
remoteHost in most case will be = remoteAddress (except if you configure the app server to use reverse DNS to try and resolve the remote IP to a host)
remoteUser will be null in most cases unless you are using BASIC authentication where the app server might expose the user (depends on the java app server and configuration)